Backout changeset 69050ad29af0 due to Mac/Linux test failures. CLOSED TREE
Backout changeset 69050ad29af0 due to Mac/Linux test failures. CLOSED TREE
--- a/configure.in
+++ b/configure.in
@@ -76,17 +76,16 @@ TARGET_OS="${target_os}"
dnl comm-central-specific options
dnl (MOZILLA_SRCDIR would fit here, but is needed to find autoconf tools)
COMM_BUILD=1
AC_SUBST(COMM_BUILD)
dnl export this, so the var is set for mozilla/configure
MOZCONFIG=`$_AUTOCONF_TOOLS_DIR/mozconfig-find $topsrcdir`
export MOZCONFIG
-echo "MOZCONFIG = $MOZCONFIG"
MOZ_DEB_TIMESTAMP=`date +"%a, %d %b %Y %T %z" 2>&1`
AC_SUBST(MOZ_DEB_TIMESTAMP)
dnl ========================================================
dnl =
dnl = Don't change the following two lines. Doing so breaks:
dnl =
--- a/mail/test/mozmill/Makefile.in
+++ b/mail/test/mozmill/Makefile.in
@@ -70,31 +70,18 @@ GARBAGE += automation.py
# Copy the mozmill bits to $(_DEST_DIR)
libs:: $(_HARNESS_FILES)
echo $(_HARNESS_FILES)
$(INSTALL) $(_HARNESS_FILES) $(_DEST_DIR)
# Copy the mailnews and mail resources that we require.
libs::
- $(INSTALL) $(topsrcdir)/mailnews/test/resources/* $(_DEST_DIR)/resources
- $(INSTALL) $(topsrcdir)/mailnews/test/fakeserver/* $(_DEST_DIR)/resources
- $(INSTALL) $(topsrcdir)/mail/base/test/unit/resources/* $(_DEST_DIR)/resources
-
-# Copy MozMill and its dependencies over, and set up a virtualenv. The
-# virtualenv directory is outside because we don't want to bundle it up during
-# stage-package.
-VIRTUALENV_DIR = $(_DEST_DIR)/../mozmill-virtualenv
-mozmill-virtualenv: NSDISTMODE=copy
-mozmill-virtualenv:
- $(DIR_INSTALL) $(topsrcdir)/mail/test/resources $(_DEST_DIR)
- rm -rf $(VIRTUALENV_DIR) && \
- mkdir $(VIRTUALENV_DIR) && \
- $(PYTHON) $(_DEST_DIR)/resources/installmozmill.py $(VIRTUALENV_DIR)
-
-libs:: mozmill-virtualenv
+ $(INSTALL) $(topsrcdir)/mailnews/test/resources/* $(MOZDEPTH)/_tests/mozmill/resources
+ $(INSTALL) $(topsrcdir)/mailnews/test/fakeserver/* $(MOZDEPTH)/_tests/mozmill/resources
+ $(INSTALL) $(topsrcdir)/mail/base/test/unit/resources/* $(MOZDEPTH)/_tests/mozmill/resources
PKG_STAGE = $(DIST)/test-package-stage
stage-package:
$(NSINSTALL) -D $(PKG_STAGE)/mozmill/
@(cd $(topsrcdir)/mail/test/mozmill && tar $(TAR_CREATE_FLAGS) - *) | (cd $(PKG_STAGE)/mozmill/ && tar -xf -)
@(cd $(MOZDEPTH)/_tests/mozmill && tar $(TAR_CREATE_FLAGS) - *) | (cd $(PKG_STAGE)/mozmill/ && tar -xf -)
--- a/mail/test/mozmill/folder-display/test-message-commands.js
+++ b/mail/test/mozmill/folder-display/test-message-commands.js
@@ -477,13 +477,8 @@ function test_tag_keys_disabled_in_conte
wait_for_content_tab_load(tab);
assert_content_tab_has_url(tab, 'about:addons');
// Make sure pressing the "1" key in a content tab doesn't tag a message
check_tag_in_message(curMessage, tagArray[0], false);
mc.keypress(null, "1", {});
check_tag_in_message(curMessage, tagArray[0], false);
}
-
-function teardownModule() {
- // Make sure archiving is enabled at the end
- enable_archiving(true);
-}
\ No newline at end of file
--- a/mail/test/mozmill/message-header/test-message-header.js
+++ b/mail/test/mozmill/message-header/test-message-header.js
@@ -44,44 +44,43 @@ var MODULE_NAME = 'test-message-header';
var RELATIVE_ROOT = '../shared-modules';
var MODULE_REQUIRES = ['folder-display-helpers', 'window-helpers',
'address-book-helpers'];
var elib = {};
Cu.import('resource://mozmill/modules/elementslib.js', elib);
var folder;
-var gInterestingMessage;
function setupModule(module) {
let fdh = collector.getModule('folder-display-helpers');
fdh.installInto(module);
let wh = collector.getModule('window-helpers');
wh.installInto(module);
let abh = collector.getModule('address-book-helpers');
abh.installInto(module);
folder = create_folder("MessageWindowA");
// create a message that has the interesting headers that commonly
// show up in the message header pane for testing
- gInterestingMessage = create_message({cc: msgGen.makeNamesAndAddresses(20), // YYY
- subject: "This is a really, really, really, really, really, really, really, really, long subject.",
- clobberHeaders: {
- "Newsgroups": "alt.test",
- "Reply-To": "J. Doe <j.doe@momo.invalid>",
- "Content-Base": "http://example.com/",
- "Bcc": "Richard Roe <richard.roe@momo.invalid>"
- }});
+ let msg = create_message({cc: msgGen.makeNamesAndAddresses(20), // YYY
+ subject: "This is a really, really, really, really, really, really, really, really, long subject.",
+ clobberHeaders: {
+ "Newsgroups": "alt.test",
+ "Reply-To": "J. Doe <j.doe@momo.invalid>",
+ "Content-Base": "http://example.com/",
+ "Bcc": "Richard Roe <richard.roe@momo.invalid>"
+ }});
- add_message_to_folder(folder, gInterestingMessage);
+ add_message_to_folder(folder, msg);
// create a message that has boring headers to be able to switch to and
// back from, to force the more button to collapse again.
- let msg = create_message();
+ msg = create_message();
add_message_to_folder(folder, msg);
}
function test_add_tag_with_really_long_label() {
be_in_folder(folder);
// select the first message, which will display it
let curMessage = select_click_row(0);
@@ -128,16 +127,161 @@ function test_add_tag_with_really_long_l
// Remove the tag and put it back so that the a11y label gets regenerated
// with the normal value rather than "taaaaaaaags"
tagsLabel.value = oldTagsValue;
mc.keypress(mc.eid("expandedHeadersNameColumn"), "1", {});
mc.keypress(mc.eid("expandedHeadersNameColumn"), "1", {});
}
+/**
+ * @param headerName used for pretty-printing in exceptions
+ * @param headerValueElement code to be eval()ed returning the DOM element
+ * with the data.
+ * @param expectedName code to be eval()ed returning the expected value of
+ * nsIAccessible.name for the DOM element in question
+ * @param expectedRole the expected value for nsIAccessible.role
+ */
+let headersToTest = [
+{
+ headerName: "Subject",
+ headerValueElement: "mc.a('expandedsubjectBox', {class: 'headerValue'})",
+ expectedName: "mc.e('expandedsubjectLabel').value.slice(0,-1) + ': ' + " +
+ "headerValueElement.textContent",
+ expectedRole: Ci.nsIAccessibleRole.ROLE_ENTRY
+},
+{
+ headerName: "Content-Base",
+ headerValueElement: "mc.a('expandedcontent-baseBox', {class: 'headerValue text-link headerValueUrl'})",
+ expectedName: "mc.e('expandedcontent-baseLabel').value.slice(0,-1) + ': ' + " +
+ "headerValueElement.textContent",
+ expectedRole: Ci.nsIAccessibleRole.ROLE_ENTRY
+},
+{
+ headerName: "From",
+ headerValueElement: "mc.window.document.getAnonymousElementByAttribute(" +
+ "mc.a('expandedfromBox', {tagName: 'mail-emailaddress'})," +
+ "'class', 'emailDisplayButton')",
+ expectedName: "mc.e('expandedfromLabel').value.slice(0,-1) + ': ' + " +
+ "headerValueElement.parentNode.getAttribute('fullAddress')",
+ expectedRole: Ci.nsIAccessibleRole.ROLE_ENTRY
+},
+{
+ headerName: "To",
+ headerValueElement: "mc.window.document.getAnonymousElementByAttribute(" +
+ "mc.a('expandedtoBox', {tagName: 'mail-emailaddress'})," +
+ "'class', 'emailDisplayButton')",
+ expectedName: "mc.e('expandedtoLabel').value.slice(0,-1) + ': ' + " +
+ "headerValueElement.parentNode.getAttribute('fullAddress')",
+ expectedRole: Ci.nsIAccessibleRole.ROLE_ENTRY
+},
+{
+ headerName: "Cc",
+ headerValueElement: "mc.window.document.getAnonymousElementByAttribute(" +
+ "mc.a('expandedccBox', {tagName: 'mail-emailaddress'})," +
+ "'class', 'emailDisplayButton')",
+ expectedName: "mc.e('expandedccLabel').value.slice(0,-1) + ': ' + " +
+ "headerValueElement.parentNode.getAttribute('fullAddress')",
+ expectedRole: Ci.nsIAccessibleRole.ROLE_ENTRY
+},
+{
+ headerName: "Bcc",
+ headerValueElement: "mc.window.document.getAnonymousElementByAttribute(" +
+ "mc.a('expandedbccBox', {tagName: 'mail-emailaddress'})," +
+ "'class', 'emailDisplayButton')",
+ expectedName: "mc.e('expandedbccLabel').value.slice(0,-1) + ': ' + " +
+ "headerValueElement.parentNode.getAttribute('fullAddress')",
+ expectedRole: Ci.nsIAccessibleRole.ROLE_ENTRY
+},
+{
+ headerName: "Reply-To",
+ headerValueElement: "mc.window.document.getAnonymousElementByAttribute(" +
+ "mc.a('expandedreply-toBox', {tagName: 'mail-emailaddress'})," +
+ "'class', 'emailDisplayButton')",
+ expectedName: "mc.e('expandedreply-toLabel').value.slice(0,-1) + ': ' + " +
+ "headerValueElement.parentNode.getAttribute('fullAddress')",
+ expectedRole: Ci.nsIAccessibleRole.ROLE_ENTRY
+},
+{
+ headerName: "Newsgroups",
+ headerValueElement: "mc.window.document.getAnonymousElementByAttribute(" +
+ "mc.a('expandednewsgroupsBox', {tagName: 'mail-newsgroup'})," +
+ "'class', 'newsgrouplabel')",
+ expectedName: "mc.e('expandednewsgroupsLabel').value.slice(0,-1) + ': ' + " +
+ "headerValueElement.parentNode.parentNode.getAttribute('newsgroup')",
+ expectedRole: Ci.nsIAccessibleRole.ROLE_ENTRY
+},
+{
+ headerName: "Tags",
+ headerValueElement: "mc.a('expandedtagsBox', {class: 'tagvalue blc-FF0000'})",
+ expectedName: "mc.e('expandedtagsLabel').value.slice(0,-1) + ': ' + " +
+ "headerValueElement.getAttribute('value')",
+ expectedRole: Ci.nsIAccessibleRole.ROLE_LABEL
+}
+];
+
+// used to get the accessible object for a DOM node
+let gAccRetrieval = Cc["@mozilla.org/accessibleRetrieval;1"].
+ getService(Ci.nsIAccessibleRetrieval);
+
+/**
+ * Use the information from aHeaderInfo to verify that screenreaders will
+ * do the right thing with the given message header.
+ *
+ * @param {Object} aHeaderInfo Information about how to do the verification;
+ * See the comments above the headersToTest array
+ * for details.
+ */
+function verify_header_a11y(aHeaderInfo) {
+ // XXX Don't use eval here.
+ let headerValueElement = eval(aHeaderInfo.headerValueElement);
+
+ let headerAccessible = gAccRetrieval.getAccessibleFor(headerValueElement);
+ if (headerAccessible.role != aHeaderInfo.expectedRole) {
+ throw new Error("role for " + aHeaderInfo.headerName + " was " +
+ headerAccessible.role + "; should have been " +
+ aHeaderInfo.expectedRole);
+ }
+
+ // XXX Don't use eval here.
+ let expectedName = eval(aHeaderInfo.expectedName);
+ if (headerAccessible.name != expectedName) {
+ throw new Error("headerAccessible.name for " + aHeaderInfo.headerName +
+ " was '" + headerAccessible.name + "'; expected '" +
+ expectedName + "'");
+ }
+}
+
+/**
+ * Test the accessibility attributes of the various message headers.
+ *
+ * XXX This test used to be after test_more_button_with_many_recipients,
+ * however, there were some accessibility changes that it didn't seem to play
+ * nicely with, and the toggling of the "more" button on the cc field was
+ * causing this test to fail on the cc element. Tests with accessibilty
+ * hardware/software showed that the code was working fine. Therefore the test
+ * may be suspect.
+ */
+function test_a11y_attrs() {
+ // skip this test on platforms that don't support accessibility
+ if (!("nsIAccessibleRole" in Components.interfaces))
+ return;
+
+ be_in_folder(folder);
+
+ // select and open the first message
+ let curMessage = select_click_row(0);
+
+ // make sure it loads
+ wait_for_message_display_completion(mc);
+ assert_selected_and_displayed(mc, curMessage);
+
+ headersToTest.forEach(verify_header_a11y);
+}
+
function test_more_button_with_many_recipients()
{
// Start on the interesting message.
let curMessage = select_click_row(0);
// make sure it loads
wait_for_message_display_completion(mc);
assert_selected_and_displayed(mc, curMessage);
@@ -733,152 +877,8 @@ function test_get_msg_button_customize_h
if (originalServerCount != finalServerCount) {
throw new Error("number of entries in Get Message Button popup menu after " +
"header toolbar customization " +
finalServerCount + " <> as before: " +
originalServerCount);
}
}
-// Some platforms (notably Mac) don't have a11y, so disable these tests there.
-if ("nsIAccessibleRole" in Ci) {
- /**
- * @param headerName used for pretty-printing in exceptions
- * @param headerValueElement code to be eval()ed returning the DOM element
- * with the data.
- * @param expectedName code to be eval()ed returning the expected value of
- * nsIAccessible.name for the DOM element in question
- * @param expectedRole the expected value for nsIAccessible.role
- */
- let headersToTest = [
- {
- headerName: "Subject",
- headerValueElement: "mc.a('expandedsubjectBox', {class: 'headerValue'})",
- expectedName: "mc.e('expandedsubjectLabel').value.slice(0,-1) + ': ' + " +
- "headerValueElement.textContent",
- expectedRole: Ci.nsIAccessibleRole.ROLE_ENTRY
- },
- {
- headerName: "Content-Base",
- headerValueElement: "mc.a('expandedcontent-baseBox', {class: 'headerValue text-link headerValueUrl'})",
- expectedName: "mc.e('expandedcontent-baseLabel').value.slice(0,-1) + ': ' + " +
- "headerValueElement.textContent",
- expectedRole: Ci.nsIAccessibleRole.ROLE_ENTRY
- },
- {
- headerName: "From",
- headerValueElement: "mc.window.document.getAnonymousElementByAttribute(" +
- "mc.a('expandedfromBox', {tagName: 'mail-emailaddress'})," +
- "'class', 'emailDisplayButton')",
- expectedName: "mc.e('expandedfromLabel').value.slice(0,-1) + ': ' + " +
- "headerValueElement.parentNode.getAttribute('fullAddress')",
- expectedRole: Ci.nsIAccessibleRole.ROLE_ENTRY
- },
- {
- headerName: "To",
- headerValueElement: "mc.window.document.getAnonymousElementByAttribute(" +
- "mc.a('expandedtoBox', {tagName: 'mail-emailaddress'})," +
- "'class', 'emailDisplayButton')",
- expectedName: "mc.e('expandedtoLabel').value.slice(0,-1) + ': ' + " +
- "headerValueElement.parentNode.getAttribute('fullAddress')",
- expectedRole: Ci.nsIAccessibleRole.ROLE_ENTRY
- },
- {
- headerName: "Cc",
- headerValueElement: "mc.window.document.getAnonymousElementByAttribute(" +
- "mc.a('expandedccBox', {tagName: 'mail-emailaddress'})," +
- "'class', 'emailDisplayButton')",
- expectedName: "mc.e('expandedccLabel').value.slice(0,-1) + ': ' + " +
- "headerValueElement.parentNode.getAttribute('fullAddress')",
- expectedRole: Ci.nsIAccessibleRole.ROLE_ENTRY
- },
- {
- headerName: "Bcc",
- headerValueElement: "mc.window.document.getAnonymousElementByAttribute(" +
- "mc.a('expandedbccBox', {tagName: 'mail-emailaddress'})," +
- "'class', 'emailDisplayButton')",
- expectedName: "mc.e('expandedbccLabel').value.slice(0,-1) + ': ' + " +
- "headerValueElement.parentNode.getAttribute('fullAddress')",
- expectedRole: Ci.nsIAccessibleRole.ROLE_ENTRY
- },
- {
- headerName: "Reply-To",
- headerValueElement: "mc.window.document.getAnonymousElementByAttribute(" +
- "mc.a('expandedreply-toBox', {tagName: 'mail-emailaddress'})," +
- "'class', 'emailDisplayButton')",
- expectedName: "mc.e('expandedreply-toLabel').value.slice(0,-1) + ': ' + " +
- "headerValueElement.parentNode.getAttribute('fullAddress')",
- expectedRole: Ci.nsIAccessibleRole.ROLE_ENTRY
- },
- {
- headerName: "Newsgroups",
- headerValueElement: "mc.window.document.getAnonymousElementByAttribute(" +
- "mc.a('expandednewsgroupsBox', {tagName: 'mail-newsgroup'})," +
- "'class', 'newsgrouplabel')",
- expectedName: "mc.e('expandednewsgroupsLabel').value.slice(0,-1) + ': ' + " +
- "headerValueElement.parentNode.parentNode.getAttribute('newsgroup')",
- expectedRole: Ci.nsIAccessibleRole.ROLE_ENTRY
- },
- {
- headerName: "Tags",
- headerValueElement: "mc.a('expandedtagsBox', {class: 'tagvalue blc-FF0000'})",
- expectedName: "mc.e('expandedtagsLabel').value.slice(0,-1) + ': ' + " +
- "headerValueElement.getAttribute('value')",
- expectedRole: Ci.nsIAccessibleRole.ROLE_LABEL
- }
- ];
-
- // used to get the accessible object for a DOM node
- let gAccRetrieval = Cc["@mozilla.org/accessibleRetrieval;1"].
- getService(Ci.nsIAccessibleRetrieval);
-
- /**
- * Use the information from aHeaderInfo to verify that screenreaders will
- * do the right thing with the given message header.
- *
- * @param {Object} aHeaderInfo Information about how to do the verification;
- * See the comments above the headersToTest array
- * for details.
- */
- function verify_header_a11y(aHeaderInfo) {
- // XXX Don't use eval here.
- let headerValueElement = eval(aHeaderInfo.headerValueElement);
-
- let headerAccessible = gAccRetrieval.getAccessibleFor(headerValueElement)
- if (headerAccessible.role != aHeaderInfo.expectedRole) {
- throw new Error("role for " + aHeaderInfo.headerName + " was " +
- headerAccessible.role + "; should have been " +
- aHeaderInfo.expectedRole);
- }
-
- // XXX Don't use eval here.
- let expectedName = eval(aHeaderInfo.expectedName);
- if (headerAccessible.name != expectedName) {
- throw new Error("headerAccessible.name for " + aHeaderInfo.headerName +
- " was '" + headerAccessible.name + "'; expected '" +
- expectedName + "'");
- }
- }
-
- /**
- * Test the accessibility attributes of the various message headers.
- *
- * XXX This test used to be after test_more_button_with_many_recipients,
- * however, there were some accessibility changes that it didn't seem to play
- * nicely with, and the toggling of the "more" button on the cc field was
- * causing this test to fail on the cc element. Tests with accessibilty
- * hardware/software showed that the code was working fine. Therefore the test
- * may be suspect.
- */
- function test_a11y_attrs() {
- be_in_folder(folder);
-
- // select and open the interesting message
-
- let curMessage = select_click_row(mc.dbView.findIndexOfMsgHdr(
- gInterestingMessage, false));
-
- // make sure it loads
- assert_selected_and_displayed(mc, curMessage);
-
- headersToTest.forEach(verify_header_a11y);
- }
-} // if ("nsIAccessibleRole" in Ci)
--- a/mail/test/mozmill/runtest.py
+++ b/mail/test/mozmill/runtest.py
@@ -197,19 +197,16 @@ class ThunderTestProfile(mozrunner.Thund
We always put our profile in the same location. We only clear it out
when we are creating a new profile so that we can go in after the run
and examine things for debugging or general interest.
'''
# create a clean directory
if os.path.exists(PROFILE_DIR):
shutil.rmtree(PROFILE_DIR, onerror=rmtree_onerror)
os.makedirs(PROFILE_DIR)
- print 'Using profile dir:', PROFILE_DIR
- if not os.path.exists(PROFILE_DIR):
- raise Exception('somehow failed to create profile dir!')
if wrapper is not None and hasattr(wrapper, "on_profile_created"):
# It's a little dangerous to allow on_profile_created access to the
# profile object, because it isn't fully initalized yet
wrapper.on_profile_created(PROFILE_DIR)
if (wrapper is not None and hasattr(wrapper, "NO_ACCOUNTS")
and wrapper.NO_ACCOUNTS):
@@ -290,105 +287,64 @@ class ThunderTestRunner(mozrunner.Thunde
try:
if self.use_vnc_server and self.vnc_alive:
subprocess.check_call([self.VNC_SERVER_PATH,
'-kill', ':99'])
except Exception, ex:
print '!!! Exception during killing VNC server:', ex
-def monkeypatched_15_run_tests(self, tests, sleeptime=0):
- frame = mozmill.jsbridge.JSObject(self.bridge,
- "Components.utils.import('resource://mozmill/modules/frame.js')")
- sleep(sleeptime)
-
- # transfer persisted data
- frame.persisted = self.persisted
-
- if len(tests) == 1 and not os.path.isdir(tests[0]):
- # tests[0] isn't necessarily an abspath'd path, so do that now
- test = os.path.abspath(tests[0])
- frame.runTestFile(test)
- else:
- # run the test files
- for test_dir in self.test_dirs:
- frame.runTestDirectory(test_dir)
-
- # Give a second for any callbacks to finish.
- sleep(1)
-if hasattr(mozmill.MozMill, 'find_tests'):
- # Monkey-patch run_tests
- mozmill.MozMill.old_run_tests = mozmill.MozMill.run_tests
- mozmill.MozMill.run_tests = monkeypatched_15_run_tests
-
class ThunderTestCLI(mozmill.CLI):
profile_class = ThunderTestProfile
runner_class = ThunderTestRunner
parser_options = copy.copy(mozmill.CLI.parser_options)
parser_options[('--symbols-path',)] = {"default": None, "dest": "symbols",
"help": "The path to the symbol files from build_symbols"}
def __init__(self, *args, **kwargs):
global SYMBOLS_PATH, TEST_NAME
-
- # mozmill 1.5.4 still explicitly hardcodes references to Firefox; in
- # order to avoid missing out on initializer logic or needing to copy
- # it, we monkeypatch mozmill's view of mozrunner. (Keep in mind that
- # the python module import process shallow copies dictionaries...)
- mozmill.mozrunner.FirefoxRunner = self.runner_class
- mozmill.mozrunner.FirefoxProfile = self.profile_class
-
- # note: we previously hardcoded a JS bridge timeout of 300 seconds,
- # but the default is now 60 seconds...
- mozmill.CLI.__init__(self, *args, **kwargs)
-
+ # invoke jsbridge.CLI's constructor directly since we are explicitly
+ # trying to replace mozmill's CLI constructor here (which hardcodes
+ # the firefox runner and profile in 1.3 for no clear reason).
+ jsbridge.CLI.__init__(self, *args, **kwargs)
SYMBOLS_PATH = self.options.symbols
- if isinstance(self.options.test, basestring):
- test_paths = [self.options.test]
- else:
- test_paths = self.options.test
- TEST_NAME = ', '.join([os.path.basename(t) for t in test_paths])
-
- test_dirs = self.test_dirs = []
- for test_file in test_paths:
- test_file = os.path.abspath(test_file)
- if not os.path.isdir(test_file):
- test_file = os.path.dirname(test_file)
- if not test_file in test_dirs:
- test_dirs.append(test_file)
-
- # if we are monkeypatching, give it the test directories.
- if hasattr(self.mozmill, 'find_tests'):
- self.mozmill.test_dirs = test_dirs
+ TEST_NAME = os.path.basename(self.options.test)
self._load_wrapper()
+ self.mozmill = self.mozmill_class(runner_class=self.runner_class,
+ profile_class=self.profile_class,
+ jsbridge_port=int(self.options.port),
+ jsbridge_timeout=300)
+
+ self.mozmill.add_global_listener(mozmill.LoggerListener())
+
def _load_wrapper(self):
global wrapper
"""
Load the wrapper module if it is present in the test directory.
"""
- if len(self.test_dirs) > 1:
- raise Exception("Wrapper semantics require only a single test dir")
- testdir = self.test_dirs[0]
+ if os.path.isdir(self.options.test):
+ testdir = self.options.test
+ else:
+ testdir = os.path.dirname(self.options.test)
try:
(fd, path, desc) = imp.find_module(WRAPPER_MODULE_NAME, [testdir])
except ImportError:
# No wrapper module, which is fine.
pass
else:
try:
wrapper = imp.load_module(WRAPPER_MODULE_NAME, fd, path, desc)
finally:
if fd is not None:
fd.close()
-
TEST_RESULTS = []
# Versions of MozMill prior to 1.5 did not output test-pass /
# TEST-UNEXPECTED-FAIL. Since 1.5 happened this gets output, so we only want
# a summary at the end to make it easy for developers.
def logEndTest(obj):
# If we've got a string here, we know we're later than 1.5, and we can just
# display a summary at the end as 1.5 will do TEST-UNEXPECTED-FAIL for us.
if isinstance(obj, str):
@@ -400,25 +356,17 @@ mozmill.LoggerListener.cases['mozmill.en
# We now send extended meta-data about failures. We do not want the entire
# message dumped with this extra data, so clobber the default mozmill.fail
# with one that wraps it and only tells it the exception message rather than
# the whole JSON blob.
ORIGINAL_FAILURE_LOGGER = mozmill.LoggerListener.cases['mozmill.fail']
def logFailure(obj):
if isinstance(obj, basestring):
obj = json.loads(obj)
- if 'exception' in obj:
- objex = obj['exception']
- if 'message' in objex:
- report_as = objex['message']
- else:
- report_as = 'Empty object thrown as an exception somehow'
- else:
- report_as = 'No exception provided'
- ORIGINAL_FAILURE_LOGGER(report_as)
+ ORIGINAL_FAILURE_LOGGER(obj["exception"]["message"])
mozmill.LoggerListener.cases['mozmill.fail'] = logFailure
def prettifyFilename(path, tail_segs_desired=1):
parts = path.split('/')
return '/'.join(parts[-tail_segs_desired:])
def prettyPrintException(e):
@@ -456,22 +404,18 @@ import pprint, atexit
@atexit.register
def prettyPrintResults():
for result in TEST_RESULTS:
#pprint.pprint(result)
testOrSummary = 'TEST'
if 'summary' in result:
testOrSummary = 'SUMMARY'
if len(result['fails']) == 0:
- if result.get('skipped', False):
- kind = 'SKIP'
- else:
- kind = 'PASS'
if result['name'] not in TEST_BLACKLIST:
- print '%s-%s | %s' % (testOrSummary, kind, result['name'])
+ print '%s-PASS | %s' % (testOrSummary, result['name'])
else:
print '%s-UNEXPECTED-FAIL | %s | %s' % (testOrSummary, prettifyFilename(result['filename']), result['name'])
for failure in result['fails']:
if 'exception' in failure:
prettyPrintException(failure['exception'])
@atexit.register
def dumpRichResults():
--- a/mail/test/mozmill/runtestlist.py
+++ b/mail/test/mozmill/runtestlist.py
@@ -98,17 +98,17 @@ totalDirectories = 0
f = open(options.list, 'rt')
for directory in f:
log.info("INFO | (runtestlist.py) | Running directory: %s",
directory.rstrip())
if options.dir != "":
testDirectory = os.path.join(options.dir, directory.rstrip())
else:
testDirectory = directory.rstrip()
- args = [sys.executable, "runtest.py", "-t", testDirectory,
+ args = ["python", "runtest.py", "-t", testDirectory,
"--binary", options.binary, "--symbols-path", options.symbols]
print args
outputPipe = subprocess.PIPE
proc = subprocess.Popen(args, cwd=SCRIPT_DIRECTORY, stdout = subprocess.PIPE, stderr = subprocess.STDOUT)
testErrors = 0
testPasses = 0
--- a/mail/test/mozmill/shared-modules/test-folder-display-helpers.js
+++ b/mail/test/mozmill/shared-modules/test-folder-display-helpers.js
@@ -192,37 +192,21 @@ function setupModule() {
testHelperModule.mark_sub_test_start(obj.name);
});
// Listen for the fail event so that we can annotate the failure object
// with additional metadata. This works out because we are directly handed
// a reference to the object that will be provided to the jsbridge and we
// can mutate it. (The jsbridge is a global listener and so is guaranteed
// to be invoked after our specific named listener.)
frame.events.addListener("fail", function(obj) {
- // normalize nsIExceptions so they look like JS exceptions...
- rawex = obj.exception;
- if (obj.exception != null &&
- (obj.exception instanceof Ci.nsIException)) {
- obj.exception = {
- message: "nsIException: " + rawex.message + " (" + rawex.result + ")",
- fileName: rawex.filename,
- lineNumber: rawex.lineNumber,
- name: rawex.name,
- result: rawex.result,
- stack: "",
- };
- }
-
// generate the failure notification now so it shows up in the event log
// bucket for presentation purposes.
testHelperModule._xpcshellLogger.info(
testHelperModule._testLoggerActiveContext,
- new testHelperModule._Failure(
- obj.exception ? obj.exception.message : "No Exception!",
- rawex));
+ new testHelperModule._Failure(obj.exception.message, obj.exception));
try {
obj.failureContext = {
preEvents: bucketAppender.getPreviousBucketEvents(10000),
events: bucketAppender.getBucketEvents(),
windows: windowHelper.captureWindowStatesForErrorReporting(
testHelperModule._normalize_for_json),
};
--- a/mail/test/mozmill/shared-modules/test-migration-helpers.js
+++ b/mail/test/mozmill/shared-modules/test-migration-helpers.js
@@ -124,15 +124,15 @@ function close_migration_assistant(fc) {
* contentFrame displaying the appropriate pane.
*/
function get_subpage(fc) {
let contentWindow = fc.e("contentFrame").contentWindow;
// XXX this is not my fault, but I'm not going to fix it. just make it less
// broken:
// Lie to mozmill to convince it to not explode because these frames never
- // get a mozmillDocumentLoaded attribute.
- contentWindow.mozmillDocumentLoaded = true;
+ // get a documentLoaded attribute.
+ contentWindow.documentLoaded = true;
// And sleep so the page has a chance to load
controller.sleep(1000);
let aController = new controller.MozMillController(contentWindow);
return wh.augment_controller(aController);
}
deleted file mode 100644
--- a/mail/test/resources/ManifestDestiny/PKG-INFO
+++ /dev/null
@@ -1,189 +0,0 @@
-Metadata-Version: 1.0
-Name: ManifestDestiny
-Version: 0.2.2
-Summary: universal reader for manifests
-Home-page: https://wiki.mozilla.org/Auto-tools/Projects/ManifestDestiny
-Author: Jeff Hammel
-Author-email: jhammel@mozilla.com
-License: MPL
-Description: ManifestDestiny
- ===============
-
- Universal manifests for Mozilla test harnesses
-
-
- What is ManifestDestiny?
- ------------------------
-
- What ManifestDestiny gives you is:
-
- * manifests are (ordered) lists of tests
- * tests may have an arbitrary number of key, value pairs
- * the parser returns an ordered list of test data structures, which
- are just dicts with some keys. For example, a test with no
- user-specified metadata looks like this::
-
- [{'path':
- '/home/jhammel/mozmill/src/ManifestDestiny/manifestdestiny/tests/testToolbar/testBackForwardButtons.js',
- 'name': 'testToolbar/testBackForwardButtons.js', 'here':
- '/home/jhammel/mozmill/src/ManifestDestiny/manifestdestiny/tests',
- 'manifest': '/home/jhammel/mozmill/src/ManifestDestiny/manifestdestiny/tests',}]
-
- The keys displayed here (path, name, here, and manifest) are reserved
- words for ManifestDestiny and any consuming APIs.
-
-
- Manifest Format
- ---------------
-
- Manifests are .ini file with the section names denoting the path
- relative to the manifest::
-
- [foo.js]
- [bar.js]
- [fleem.js]
-
- The sections are read in order. In addition, tests may include
- arbitrary key, value metadata to be used by the harness. You can also
- have a ``[DEFAULT]`` section that will give key, value pairs that will
- be inherited by each test unless overridden::
-
- [DEFAULT]
- type = restart
-
- [lilies.js]
- color = white
-
- [daffodils.js]
- color = yellow
- type = other
- # override type from DEFAULT
-
- [roses.js]
- color = red
-
- You can also include other manifests::
-
- [include:subdir/anothermanifest.ini]
-
-
- Data
- ----
-
- Manifest Destiny gives tests as a list of dictionary (in python
- terms).
-
- * path: full path to the test
- * name: short name of the test; this is the (usually) relative path
- specified in the section name
- * here: the parent directory of the manifest
- * manifest: the path to the manifest containing the test
-
- This data corresponds to a one-line manifest::
-
- [testToolbar/testBackForwardButtons.js]
-
- If additional key, values were specified, they would be in this dict
- as well.
-
- Outside of the reserved keys, the remaining key, values
- are up to convention to use. There is a (currently very minimal)
- generic integration layer in ManifestDestiny for use of all tests.
- For instance, if the 'disabled' key is present, you can get the set of
- tests without disabled (various other queries are doable as well).
-
- Since the system is convention-based, the harnesses may do whatever
- they want with the data. They may ignore it completely, they may use
- the provided integration layer, or they may provide their own
- integration layer. This should allow whatever sort of logic they
- want. For instance, if in yourtestharness you wanted to run only on
- mondays for a certain class of tests::
-
- tests = []
- for test in manifests.tests:
- if 'runOnDay' in test:
- if calendar.day_name[calendar.weekday(*datetime.datetime.now().timetuple()[:3])].lower() == test['runOnDay'].lower():
- tests.append(test)
- else:
- tests.append(test)
-
- To recap:
- * the manifests allow you to specify test data
- * the parser gives you this data
- * you can use it however you want or process it further as you need
-
- Tests are denoted by sections in an .ini file (see
- http://hg.mozilla.org/automation/ManifestDestiny/file/tip/manifestdestiny/tests/mozmill-example.ini).
-
- Additional manifest files may be included with a [include:] directive::
-
- [include:path-to-additional-file.manifest]
-
- The path to included files is relative to the current manifest.
-
- The ``[DEFAULT]`` section contains variables that all tests inherit from.
-
- Included files will inherit the top-level variables but may override
- in their own ``[DEFAULT]`` section.
-
-
- Creating Manifests
- ------------------
-
- ManifestDestiny comes with a console script, ``manifestparser create``, that
- may be used to create a seed manifest structure from a directory of
- files. Run ``manifestparser help create`` for usage information.
-
-
- Copying Manifests
- -----------------
-
- To copy tests and manifests from a source::
-
- manifestparser [options] copy from_manifest to_directory -tag1 -tag2 --key1=value1 key2=value2 ...
-
-
- Upating Tests
- -------------
-
- To update the tests associated with with a manifest from a source
- directory::
-
- manifestparser [options] update manifest from_directory -tag1 -tag2 --key1=value1 --key2=value2 ...
-
-
- Tests
- -----
-
- ManifestDestiny includes a suite of tests:
-
- http://hg.mozilla.org/automation/ManifestDestiny/file/tip/manifestdestiny/tests
-
- ``test_manifest.txt`` is a doctest that may be helpful in figuring out
- how to use the API. Tests are run via ``python test.py``.
-
-
- CLI
- ---
-
- Run ``manifestparser help`` for usage information.
-
- To create a manifest from a set of directories::
-
- manifestparser [options] create directory <directory> <...> [create-options]
-
- To output a manifest of tests::
-
- manifestparser [options] write manifest <manifest> <...> -tag1 -tag2 --key1=value1 --key2=value2 ...
-
- To copy tests and manifests from a source::
-
- manifestparser [options] copy from_manifest to_manifest -tag1 -tag2 --key1=value1 key2=value2 ...
-
- To update the tests associated with with a manifest from a source
- directory::
-
- manifestparser [options] update manifest from_directory -tag1 -tag2 --key1=value1 --key2=value2 ...
-
-Keywords: mozilla manifests
-Platform: UNKNOWN
deleted file mode 100644
--- a/mail/test/resources/ManifestDestiny/README.txt
+++ /dev/null
@@ -1,178 +0,0 @@
-ManifestDestiny
-===============
-
-Universal manifests for Mozilla test harnesses
-
-
-What is ManifestDestiny?
-------------------------
-
-What ManifestDestiny gives you is:
-
-* manifests are (ordered) lists of tests
-* tests may have an arbitrary number of key, value pairs
-* the parser returns an ordered list of test data structures, which
- are just dicts with some keys. For example, a test with no
- user-specified metadata looks like this::
-
- [{'path':
- '/home/jhammel/mozmill/src/ManifestDestiny/manifestdestiny/tests/testToolbar/testBackForwardButtons.js',
- 'name': 'testToolbar/testBackForwardButtons.js', 'here':
- '/home/jhammel/mozmill/src/ManifestDestiny/manifestdestiny/tests',
- 'manifest': '/home/jhammel/mozmill/src/ManifestDestiny/manifestdestiny/tests',}]
-
-The keys displayed here (path, name, here, and manifest) are reserved
-words for ManifestDestiny and any consuming APIs.
-
-
-Manifest Format
----------------
-
-Manifests are .ini file with the section names denoting the path
-relative to the manifest::
-
- [foo.js]
- [bar.js]
- [fleem.js]
-
-The sections are read in order. In addition, tests may include
-arbitrary key, value metadata to be used by the harness. You can also
-have a ``[DEFAULT]`` section that will give key, value pairs that will
-be inherited by each test unless overridden::
-
- [DEFAULT]
- type = restart
-
- [lilies.js]
- color = white
-
- [daffodils.js]
- color = yellow
- type = other
- # override type from DEFAULT
-
- [roses.js]
- color = red
-
-You can also include other manifests::
-
- [include:subdir/anothermanifest.ini]
-
-
-Data
-----
-
-Manifest Destiny gives tests as a list of dictionary (in python
-terms).
-
-* path: full path to the test
-* name: short name of the test; this is the (usually) relative path
- specified in the section name
-* here: the parent directory of the manifest
-* manifest: the path to the manifest containing the test
-
-This data corresponds to a one-line manifest::
-
- [testToolbar/testBackForwardButtons.js]
-
-If additional key, values were specified, they would be in this dict
-as well.
-
-Outside of the reserved keys, the remaining key, values
-are up to convention to use. There is a (currently very minimal)
-generic integration layer in ManifestDestiny for use of all tests.
-For instance, if the 'disabled' key is present, you can get the set of
-tests without disabled (various other queries are doable as well).
-
-Since the system is convention-based, the harnesses may do whatever
-they want with the data. They may ignore it completely, they may use
-the provided integration layer, or they may provide their own
-integration layer. This should allow whatever sort of logic they
-want. For instance, if in yourtestharness you wanted to run only on
-mondays for a certain class of tests::
-
- tests = []
- for test in manifests.tests:
- if 'runOnDay' in test:
- if calendar.day_name[calendar.weekday(*datetime.datetime.now().timetuple()[:3])].lower() == test['runOnDay'].lower():
- tests.append(test)
- else:
- tests.append(test)
-
-To recap:
-* the manifests allow you to specify test data
-* the parser gives you this data
-* you can use it however you want or process it further as you need
-
-Tests are denoted by sections in an .ini file (see
-http://hg.mozilla.org/automation/ManifestDestiny/file/tip/manifestdestiny/tests/mozmill-example.ini).
-
-Additional manifest files may be included with a [include:] directive::
-
- [include:path-to-additional-file.manifest]
-
-The path to included files is relative to the current manifest.
-
-The ``[DEFAULT]`` section contains variables that all tests inherit from.
-
-Included files will inherit the top-level variables but may override
-in their own ``[DEFAULT]`` section.
-
-
-Creating Manifests
-------------------
-
-ManifestDestiny comes with a console script, ``manifestparser create``, that
-may be used to create a seed manifest structure from a directory of
-files. Run ``manifestparser help create`` for usage information.
-
-
-Copying Manifests
------------------
-
-To copy tests and manifests from a source::
-
- manifestparser [options] copy from_manifest to_directory -tag1 -tag2 --key1=value1 key2=value2 ...
-
-
-Upating Tests
--------------
-
-To update the tests associated with with a manifest from a source
-directory::
-
- manifestparser [options] update manifest from_directory -tag1 -tag2 --key1=value1 --key2=value2 ...
-
-
-Tests
------
-
-ManifestDestiny includes a suite of tests:
-
-http://hg.mozilla.org/automation/ManifestDestiny/file/tip/manifestdestiny/tests
-
-``test_manifest.txt`` is a doctest that may be helpful in figuring out
-how to use the API. Tests are run via ``python test.py``.
-
-
-CLI
----
-
-Run ``manifestparser help`` for usage information.
-
-To create a manifest from a set of directories::
-
- manifestparser [options] create directory <directory> <...> [create-options]
-
-To output a manifest of tests::
-
- manifestparser [options] write manifest <manifest> <...> -tag1 -tag2 --key1=value1 --key2=value2 ...
-
-To copy tests and manifests from a source::
-
- manifestparser [options] copy from_manifest to_manifest -tag1 -tag2 --key1=value1 key2=value2 ...
-
-To update the tests associated with with a manifest from a source
-directory::
-
- manifestparser [options] update manifest from_directory -tag1 -tag2 --key1=value1 --key2=value2 ...
deleted file mode 100644
--- a/mail/test/resources/ManifestDestiny/manifestparser.py
+++ /dev/null
@@ -1,776 +0,0 @@
-#!/usr/bin/env python
-
-# ***** BEGIN LICENSE BLOCK *****
-# Version: MPL 1.1/GPL 2.0/LGPL 2.1
-#
-# The contents of this file are subject to the Mozilla Public License Version
-# 1.1 (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-# http://www.mozilla.org/MPL/
-#
-# Software distributed under the License is distributed on an "AS IS" basis,
-# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-# for the specific language governing rights and limitations under the
-# License.
-#
-# The Original Code is mozilla.org code.
-#
-# The Initial Developer of the Original Code is
-# Mozilla.org.
-# Portions created by the Initial Developer are Copyright (C) 2010
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-# Jeff Hammel <jhammel@mozilla.com> (Original author)
-#
-# Alternatively, the contents of this file may be used under the terms of
-# either of the GNU General Public License Version 2 or later (the "GPL"),
-# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-# in which case the provisions of the GPL or the LGPL are applicable instead
-# of those above. If you wish to allow use of your version of this file only
-# under the terms of either the GPL or the LGPL, and not to allow others to
-# use your version of this file under the terms of the MPL, indicate your
-# decision by deleting the provisions above and replace them with the notice
-# and other provisions required by the GPL or the LGPL. If you do not delete
-# the provisions above, a recipient may use your version of this file under
-# the terms of any one of the MPL, the GPL or the LGPL.
-#
-# ***** END LICENSE BLOCK *****
-
-"""
-Mozilla universal manifest parser
-"""
-
-# this file lives at
-# http://hg.mozilla.org/automation/ManifestDestiny/raw-file/tip/manifestparser.py
-
-__all__ = ['ManifestParser', 'TestManifest', 'convert']
-
-import os
-import shutil
-import sys
-from fnmatch import fnmatch
-from optparse import OptionParser
-
-version = '0.2.2' # package version
-try:
- from setuptools import setup
-except ImportError:
- setup = None
-
-def read_ini(fp, variables=None, default='DEFAULT',
- comments=';#', separators=('=', ':'),
- strict=True):
- """
- read an .ini file and return a list of [(section, values)]
- - fp : file pointer or path to read
- - variables : default set of variables
- - default : name of the section for the default section
- - comments : characters that if they start a line denote a comment
- - separators : strings that denote key, value separation in order
- - strict : whether to be strict about parsing
- """
-
- if variables is None:
- variables = {}
-
- if isinstance(fp, basestring):
- fp = file(fp)
-
- sections = []
- key = value = None
- section_names = set([])
-
- # read the lines
- for line in fp.readlines():
-
- stripped = line.strip()
-
- # ignore blank lines
- if not stripped:
- # reset key and value to avoid continuation lines
- key = value = None
- continue
-
- # ignore comment lines
- if stripped[0] in comments:
- continue
-
- # check for a new section
- if len(stripped) > 2 and stripped[0] == '[' and stripped[-1] == ']':
- section = stripped[1:-1].strip()
- key = value = None
-
- # deal with DEFAULT section
- if section.lower() == default.lower():
- if strict:
- assert default not in section_names
- section_names.add(default)
- current_section = variables
- continue
-
- if strict:
- # make sure this section doesn't already exist
- assert section not in section_names
-
- section_names.add(section)
- current_section = {}
- sections.append((section, current_section))
- continue
-
- # if there aren't any sections yet, something bad happen
- if not section_names:
- raise Exception('No sections yet :(')
-
- # (key, value) pair
- for separator in separators:
- if separator in stripped:
- key, value = stripped.split(separator, 1)
- key = key.strip()
- value = value.strip()
-
- if strict:
- # make sure this key isn't already in the section or empty
- assert key
- if current_section is not variables:
- assert key not in current_section
-
- current_section[key] = value
- break
- else:
- # continuation line ?
- if line[0].isspace() and key:
- value = '%s%s%s' % (value, os.linesep, stripped)
- current_section[key] = value
- else:
- # something bad happen!
- raise Exception("Not sure what you're trying to do")
-
- # interpret the variables
- def interpret_variables(global_dict, local_dict):
- variables = global_dict.copy()
- variables.update(local_dict)
- return variables
-
- sections = [(i, interpret_variables(variables, j)) for i, j in sections]
- return sections
-
-
-### objects for parsing manifests
-
-class ManifestParser(object):
- """read .ini manifests"""
-
- ### methods for reading manifests
-
- def __init__(self, manifests=(), defaults=None, strict=True):
- self._defaults = defaults or {}
- self.tests = []
- self.strict = strict
- self.rootdir = None
- if manifests:
- self.read(*manifests)
-
- def read(self, *filenames, **defaults):
-
- # ensure all files exist
- missing = [ filename for filename in filenames
- if not os.path.exists(filename) ]
- if missing:
- raise IOError('Missing files: %s' % ', '.join(missing))
-
- # process each file
- for filename in filenames:
-
- # set the per file defaults
- defaults = defaults.copy() or self._defaults.copy()
- here = os.path.dirname(os.path.abspath(filename))
- defaults['here'] = here
-
- if self.rootdir is None:
- # set the root directory
- # == the directory of the first manifest given
- self.rootdir = here
-
- # read the configuration
- sections = read_ini(filename, variables=defaults)
-
- # get the tests
- for section, data in sections:
-
- # a file to include
- # TODO: keep track of structure:
- # self.manifests = {'manifest.ini': 'relative/path.ini'}
- if section.startswith('include:'):
- include_file = section.split('include:', 1)[-1]
- include_file = os.path.join(here, include_file)
- if not os.path.exists(include_file):
- if strict:
- raise IOError("File '%s' does not exist" % include_file)
- else:
- continue
- include_defaults = data.copy()
- self.read(include_file, **include_defaults)
- continue
-
- # otherwise a test
- test = data
- test['name'] = section
- test['path'] = os.path.join(here, section)
- test['manifest'] = os.path.abspath(filename)
- self.tests.append(test)
-
- ### methods for querying manifests
-
- def query(self, *checks):
- """
- general query function for tests
- - checks : callable conditions to test if the test fulfills the query
- """
- retval = []
- for test in self.tests:
- for check in checks:
- if not check(test):
- break
- else:
- retval.append(test)
- return retval
-
- def get(self, _key=None, inverse=False, tags=None, **kwargs):
- # TODO: pass a dict instead of kwargs since you might hav
- # e.g. 'inverse' as a key in the dict
-
- # TODO: tags should just be part of kwargs with None values
- # (None == any is kinda weird, but probably still better)
-
- # fix up tags
- if tags:
- tags = set(tags)
- else:
- tags = set()
-
- # make some check functions
- if inverse:
- has_tags = lambda test: tags.isdisjoint(test.keys())
- def dict_query(test):
- for key, value in kwargs.items():
- if test.get(key) == value:
- return False
- return True
- else:
- has_tags = lambda test: tags.issubset(test.keys())
- def dict_query(test):
- for key, value in kwargs.items():
- if test.get(key) != value:
- return False
- return True
-
- # query the tests
- tests = self.query(has_tags, dict_query)
-
- # if a key is given, return only a list of that key
- # useful for keys like 'name' or 'path'
- if _key:
- return [test[_key] for test in tests]
-
- # return the tests
- return tests
-
- def missing(self, tests=None):
- """return list of tests that do not exist on the filesystem"""
- if tests is None:
- tests = self.tests
- return [test for test in tests
- if not os.path.exists(test['path'])]
-
- def manifests(self, tests=None):
- """
- return manifests in order in which they appear in the tests
- """
- if tests is None:
- tests = self.tests
- manifests = []
- for test in tests:
- manifest = test.get('manifest')
- if not manifest:
- continue
- if manifest not in manifests:
- manifests.append(manifest)
- return manifests
-
-
- ### methods for outputting from manifests
-
- def write(self, fp=sys.stdout, rootdir=None,
- global_tags=None, global_kwargs=None,
- local_tags=None, local_kwargs=None):
- """
- write a manifest given a query
- global and local options will be munged to do the query
- globals will be written to the top of the file
- locals (if given) will be written per test
- """
-
- # root directory
- if rootdir is None:
- rootdir = self.rootdir
-
- # sanitize input
- global_tags = global_tags or set()
- local_tags = local_tags or set()
- global_kwargs = global_kwargs or {}
- local_kwargs = local_kwargs or {}
-
- # create the query
- tags = set([])
- tags.update(global_tags)
- tags.update(local_tags)
- kwargs = {}
- kwargs.update(global_kwargs)
- kwargs.update(local_kwargs)
-
- # get matching tests
- tests = self.get(tags=tags, **kwargs)
-
- # print the .ini manifest
- if global_tags or global_kwargs:
- print >> fp, '[DEFAULT]'
- for tag in global_tags:
- print >> fp, '%s =' % tag
- for key, value in global_kwargs.items():
- print >> fp, '%s = %s' % (key, value)
- print >> fp
-
- for test in tests:
- test = test.copy() # don't overwrite
-
- path = test['name']
- if not os.path.isabs(path):
- path = os.path.relpath(test['path'], self.rootdir)
- print >> fp, '[%s]' % path
-
- # reserved keywords:
- reserved = ['path', 'name', 'here', 'manifest']
- for key in sorted(test.keys()):
- if key in reserved:
- continue
- if key in global_kwargs:
- continue
- if key in global_tags and not test[key]:
- continue
- print >> fp, '%s = %s' % (key, test[key])
- print >> fp
-
- def copy(self, directory, rootdir=None, *tags, **kwargs):
- """
- copy the manifests and associated tests
- - directory : directory to copy to
- - rootdir : root directory to copy to (if not given from manifests)
- - tags : keywords the tests must have
- - kwargs : key, values the tests must match
- """
- # XXX note that copy does *not* filter the tests out of the
- # resulting manifest; it just stupidly copies them over.
- # ideally, it would reread the manifests and filter out the
- # tests that don't match *tags and **kwargs
-
- # destination
- if not os.path.exists(directory):
- os.path.makedirs(directory)
- else:
- # sanity check
- assert os.path.isdir(directory)
-
- # tests to copy
- tests = self.get(tags=tags, **kwargs)
- if not tests:
- return # nothing to do!
-
- # root directory
- if rootdir is None:
- rootdir = self.rootdir
-
- # copy the manifests + tests
- manifests = [os.path.relpath(manifest, rootdir) for manifest in self.manifests()]
- for manifest in manifests:
- destination = os.path.join(directory, manifest)
- dirname = os.path.dirname(destination)
- if not os.path.exists(dirname):
- os.makedirs(dirname)
- else:
- # sanity check
- assert os.path.isdir(dirname)
- shutil.copy(os.path.join(rootdir, manifest), destination)
- for test in tests:
- if os.path.isabs(test['name']):
- continue
- source = test['path']
- if not os.path.exists(source):
- print >> sys.stderr, "Missing test: '%s' does not exist!" % source
- continue
- # TODO: should err on strict
- destination = os.path.join(directory, os.path.relpath(test['path'], rootdir))
- shutil.copy(source, destination)
- # TODO: ensure that all of the tests are below the from_dir
-
- def update(self, from_dir, rootdir=None, *tags, **kwargs):
- """
- update the tests as listed in a manifest from a directory
- - from_dir : directory where the tests live
- - rootdir : root directory to copy to (if not given from manifests)
- - tags : keys the tests must have
- - kwargs : key, values the tests must match
- """
-
- # get the tests
- tests = self.get(tags=tags, **kwargs)
-
- # get the root directory
- if not rootdir:
- rootdir = self.rootdir
-
- # copy them!
- for test in tests:
- if not os.path.isabs(test['name']):
- relpath = os.path.relpath(test['path'], rootdir)
- source = os.path.join(from_dir, relpath)
- if not os.path.exists(source):
- # TODO err on strict
- print >> sys.stderr, "Missing test: '%s'; skipping" % test['name']
- continue
- destination = os.path.join(rootdir, relpath)
- shutil.copy(source, destination)
-
-
-class TestManifest(ManifestParser):
- """
- apply logic to manifests; this is your integration layer :)
- specific harnesses may subclass from this if they need more logic
- """
-
- def active_tests(self):
-
- # ignore disabled tests
- tests = self.get(inverse=True, tags=['disabled'])
-
- # TODO: could filter out by current platform, existence, etc
- return tests
-
- def test_paths(self):
- return [test['path'] for test in self.active_tests()]
-
-
-### utility function(s); probably belongs elsewhere
-
-def convert(directories, pattern=None, ignore=(), write=None):
- """
- convert directories to a simple manifest
- """
-
- retval = []
- include = []
- for directory in directories:
- for dirpath, dirnames, filenames in os.walk(directory):
-
- # filter out directory names
- dirnames = [ i for i in dirnames if i not in ignore ]
- dirnames.sort()
-
- # reference only the subdirectory
- _dirpath = dirpath
- dirpath = dirpath.split(directory, 1)[-1].strip('/')
-
- if dirpath.split(os.path.sep)[0] in ignore:
- continue
-
- # filter by glob
- if pattern:
- filenames = [filename for filename in filenames
- if fnmatch(filename, pattern)]
-
- filenames.sort()
-
- # write a manifest for each directory
- if write and (dirnames or filenames):
- manifest = file(os.path.join(_dirpath, write), 'w')
- for dirname in dirnames:
- print >> manifest, '[include:%s]' % os.path.join(dirname, write)
- for filename in filenames:
- print >> manifest, '[%s]' % filename
- manifest.close()
-
- # add to the list
- retval.extend([os.path.join(dirpath, filename)
- for filename in filenames])
-
- if write:
- return # the manifests have already been written!
-
- retval.sort()
- retval = ['[%s]' % filename for filename in retval]
- return '\n'.join(retval)
-
-### command line attributes
-
-class ParserError(Exception):
- """error for exceptions while parsing the command line"""
-
-def parse_args(_args):
- """
- parse and return:
- --keys=value (or --key value)
- -tags
- args
- """
-
-
- # return values
- _dict = {}
- tags = []
- args = []
-
- # parse the arguments
- key = None
- for arg in _args:
- if arg.startswith('---'):
- raise ParserError("arguments should start with '-' or '--' only")
- elif arg.startswith('--'):
- if key:
- raise ParserError("Key %s still open" % key)
- key = arg[2:]
- if '=' in key:
- key, value = key.split('=', 1)
- _dict[key] = value
- key = None
- continue
- elif arg.startswith('-'):
- if key:
- raise ParserError("Key %s still open" % key)
- tags.append(arg[1:])
- continue
- else:
- if key:
- _dict[key] = arg
- continue
- args.append(arg)
-
- # return values
- return (_dict, tags, args)
-
-
-### classes for subcommands
-
-class CLICommand(object):
- usage = '%prog [options] command'
- def __init__(self, parser):
- self._parser = parser # master parser
- def parser(self):
- return OptionParser(usage=self.usage, description=self.__doc__,
- add_help_option=False)
-
-class Copy(CLICommand):
- usage = '%prog [options] copy manifest directory -tag1 -tag2 --key1=value1 --key2=value2 ...'
- def __call__(self, options, args):
- # parse the arguments
- try:
- kwargs, tags, args = parse_args(args)
- except ParserError, e:
- self._parser.error(e.message)
-
- # make sure we have some manifests, otherwise it will
- # be quite boring
- if not len(args) == 2:
- HelpCLI(self._parser)(options, ['copy'])
- return
-
- # read the manifests
- # TODO: should probably ensure these exist here
- manifests = ManifestParser()
- manifests.read(args[0])
-
- # print the resultant query
- manifests.copy(args[1], None, *tags, **kwargs)
-
-
-class CreateCLI(CLICommand):
- """
- create a manifest from a list of directories
- """
- usage = '%prog [options] create directory <directory> <...>'
-
- def parser(self):
- parser = CLICommand.parser(self)
- parser.add_option('-p', '--pattern', dest='pattern',
- help="glob pattern for files")
- parser.add_option('-i', '--ignore', dest='ignore',
- default=[], action='append',
- help='directories to ignore')
- parser.add_option('-w', '--in-place', dest='in_place',
- help='Write .ini files in place; filename to write to')
- return parser
-
- def __call__(self, _options, args):
- parser = self.parser()
- options, args = parser.parse_args(args)
-
- # need some directories
- if not len(args):
- parser.print_usage()
- return
-
- # add the directories to the manifest
- for arg in args:
- assert os.path.exists(arg)
- assert os.path.isdir(arg)
- manifest = convert(args, pattern=options.pattern, ignore=options.ignore,
- write=options.in_place)
- if manifest:
- print manifest
-
-
-class WriteCLI(CLICommand):
- """
- write a manifest based on a query
- """
- usage = '%prog [options] write manifest <manifest> -tag1 -tag2 --key1=value1 --key2=value2 ...'
- def __call__(self, options, args):
-
- # parse the arguments
- try:
- kwargs, tags, args = parse_args(args)
- except ParserError, e:
- self._parser.error(e.message)
-
- # make sure we have some manifests, otherwise it will
- # be quite boring
- if not args:
- HelpCLI(self._parser)(options, ['write'])
- return
-
- # read the manifests
- # TODO: should probably ensure these exist here
- manifests = ManifestParser()
- manifests.read(*args)
-
- # print the resultant query
- manifests.write(global_tags=tags, global_kwargs=kwargs)
-
-
-class HelpCLI(CLICommand):
- """
- get help on a command
- """
- usage = '%prog [options] help [command]'
-
- def __call__(self, options, args):
- if len(args) == 1 and args[0] in commands:
- commands[args[0]](self._parser).parser().print_help()
- else:
- self._parser.print_help()
- print '\nCommands:'
- for command in sorted(commands):
- print ' %s : %s' % (command, commands[command].__doc__.strip())
-
-class SetupCLI(CLICommand):
- """
- setup using setuptools
- """
- usage = '%prog [options] setup [setuptools options]'
-
- def __call__(self, options, args):
- sys.argv = [sys.argv[0]] + args
- assert setup is not None, "You must have setuptools installed to use SetupCLI"
- here = os.path.dirname(os.path.abspath(__file__))
- try:
- filename = os.path.join(here, 'README.txt')
- description = file(filename).read()
- except:
- description = ''
- os.chdir(here)
-
- setup(name='ManifestDestiny',
- version=version,
- description="universal reader for manifests",
- long_description=description,
- classifiers=[], # Get strings from http://pypi.python.org/pypi?%3Aaction=list_classifiers
- keywords='mozilla manifests',
- author='Jeff Hammel',
- author_email='jhammel@mozilla.com',
- url='https://wiki.mozilla.org/Auto-tools/Projects/ManifestDestiny',
- license='MPL',
- zip_safe=False,
- py_modules=['manifestparser'],
- install_requires=[
- # -*- Extra requirements: -*-
- ],
- entry_points="""
- [console_scripts]
- manifestparser = manifestparser:main
- """,
- )
-
-
-class UpdateCLI(CLICommand):
- """
- update the tests as listed in a manifest from a directory
- """
- usage = '%prog [options] update manifest directory -tag1 -tag2 --key1=value1 --key2=value2 ...'
-
- def __call__(self, options, args):
- # parse the arguments
- try:
- kwargs, tags, args = parse_args(args)
- except ParserError, e:
- self._parser.error(e.message)
-
- # make sure we have some manifests, otherwise it will
- # be quite boring
- if not len(args) == 2:
- HelpCLI(self._parser)(options, ['update'])
- return
-
- # read the manifests
- # TODO: should probably ensure these exist here
- manifests = ManifestParser()
- manifests.read(args[0])
-
- # print the resultant query
- manifests.update(args[1], None, *tags, **kwargs)
-
-
-# command -> class mapping
-commands = { 'create': CreateCLI,
- 'help': HelpCLI,
- 'update': UpdateCLI,
- 'write': WriteCLI }
-if setup is not None:
- commands['setup'] = SetupCLI
-
-def main(args=sys.argv[1:]):
- """console_script entry point"""
-
- # set up an option parser
- usage = '%prog [options] [command] ...'
- description = __doc__
- parser = OptionParser(usage=usage, description=description)
- parser.add_option('-s', '--strict', dest='strict',
- action='store_true', default=False,
- help='adhere strictly to errors')
- parser.disable_interspersed_args()
-
- options, args = parser.parse_args(args)
-
- if not args:
- HelpCLI(parser)(options, args)
- parser.exit()
-
- # get the command
- command = args[0]
- if command not in commands:
- parser.error("Command must be one of %s (you gave '%s')" % (', '.join(sorted(commands.keys())), command))
-
- handler = commands[command](parser)
- handler(options, args[1:])
-
-if __name__ == '__main__':
- main()
deleted file mode 100644
--- a/mail/test/resources/ManifestDestiny/setup.cfg
+++ /dev/null
@@ -1,5 +0,0 @@
-[egg_info]
-tag_build =
-tag_date = 0
-tag_svn_revision = 0
-
deleted file mode 100644
--- a/mail/test/resources/ManifestDestiny/setup.py
+++ /dev/null
@@ -1,48 +0,0 @@
-#!/usr/bin/env python
-
-# ***** BEGIN LICENSE BLOCK *****
-# Version: MPL 1.1/GPL 2.0/LGPL 2.1
-#
-# The contents of this file are subject to the Mozilla Public License Version
-# 1.1 (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-# http://www.mozilla.org/MPL/
-#
-# Software distributed under the License is distributed on an "AS IS" basis,
-# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-# for the specific language governing rights and limitations under the
-# License.
-#
-# The Original Code is mozilla.org code.
-#
-# The Initial Developer of the Original Code is
-# Mozilla.org.
-# Portions created by the Initial Developer are Copyright (C) 2011
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-# Jeff Hammel <jhammel@mozilla.com> (Original author)
-#
-# Alternatively, the contents of this file may be used under the terms of
-# either of the GNU General Public License Version 2 or later (the "GPL"),
-# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-# in which case the provisions of the GPL or the LGPL are applicable instead
-# of those above. If you wish to allow use of your version of this file only
-# under the terms of either the GPL or the LGPL, and not to allow others to
-# use your version of this file under the terms of the MPL, indicate your
-# decision by deleting the provisions above and replace them with the notice
-# and other provisions required by the GPL or the LGPL. If you do not delete
-# the provisions above, a recipient may use your version of this file under
-# the terms of any one of the MPL, the GPL or the LGPL.
-#
-# ***** END LICENSE BLOCK *****
-
-# The real details are in manifestparser.py; this is just a front-end
-
-
-import sys
-from manifestparser import SetupCLI
-SetupCLI(None)(None, sys.argv[1:])
-
-
-
deleted file mode 100644
--- a/mail/test/resources/installmozmill.py
+++ /dev/null
@@ -1,126 +0,0 @@
-#!/usr/bin/env python
-
-# ***** BEGIN LICENSE BLOCK *****
-# Version: MPL 1.1/GPL 2.0/LGPL 2.1
-#
-# The contents of this file are subject to the Mozilla Public License Version
-# 1.1 (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-# http://www.mozilla.org/MPL/
-#
-# Software distributed under the License is distributed on an "AS IS" basis,
-# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-# for the specific language governing rights and limitations under the
-# License.
-#
-# The Original Code is mozilla.org code.
-#
-# The Initial Developer of the Original Code is
-# Mozilla.org.
-# Portions created by the Initial Developer are Copyright (C) 2010
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-# Jeff Hammel <jhammel@mozilla.com> (Original author)
-# Siddharth Agarwal <sid.bugzilla@gmail.com>
-#
-# Alternatively, the contents of this file may be used under the terms of
-# either of the GNU General Public License Version 2 or later (the "GPL"),
-# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-# in which case the provisions of the GPL or the LGPL are applicable instead
-# of those above. If you wish to allow use of your version of this file only
-# under the terms of either the GPL or the LGPL, and not to allow others to
-# use your version of this file under the terms of the MPL, indicate your
-# decision by deleting the provisions above and replace them with the notice
-# and other provisions required by the GPL or the LGPL. If you do not delete
-# the provisions above, a recipient may use your version of this file under
-# the terms of any one of the MPL, the GPL or the LGPL.
-#
-# ***** END LICENSE BLOCK *****
-
-"""
-install mozmill and its dependencies
-"""
-
-import os
-import sys
-from subprocess import call
-
-### utility functions for cross-platform
-
-def is_windows():
- return sys.platform.startswith('win')
-
-def esc(path):
- """quote and escape a path for cross-platform use"""
- return '"%s"' % repr(path)[1:-1]
-
-def scripts_path(virtual_env):
- """path to scripts directory"""
- if is_windows():
- return os.path.join(virtual_env, 'Scripts')
- return os.path.join(virtual_env, 'bin')
-
-def python_script_path(virtual_env, script_name):
- """path to a python script in a virtualenv"""
- scripts_dir = scripts_path(virtual_env)
- if is_windows():
- script_name = script_name + '-script.py'
- return os.path.join(scripts_dir, script_name)
-
-def entry_point_path(virtual_env, entry_point):
- path = os.path.join(scripts_path(virtual_env), entry_point)
- if is_windows():
- path += '.exe'
- return path
-
-### command-line entry point
-
-def main(args=None):
- """command line front-end function"""
-
- # parse command line arguments
- args = args or sys.argv[1:]
- usage = "Usage: %prog [destination]"
-
- # Print the python version
- print 'Python: %s' % sys.version
-
- # The data is kept in the same directory as the script
- source=os.path.abspath(os.path.dirname(__file__))
-
- # directory to install to
- if not len(args):
- destination = source
- elif len(args) == 1:
- destination = os.path.abspath(args[0])
- else:
- print "Usage: %s [destination]" % sys.argv[0]
- sys.exit(1)
-
- os.chdir(source)
-
- # check for existence of necessary files
- if not os.path.exists('virtualenv'):
- print "File not found: virtualenv"
- sys.exit(1)
-
- # packages to install in dependency order
- packages = ["ManifestDestiny", "simplejson-2.1.6", "mozrunner", "jsbridge",
- "mozmill"]
-
- # create the virtualenv and install packages
- env = os.environ.copy()
- env.pop('PYTHONHOME', None)
- returncode = call([sys.executable, os.path.join('virtualenv', 'virtualenv.py'), destination], env=env)
- if returncode:
- print 'Failure to install virtualenv'
- sys.exit(returncode)
- pip = entry_point_path(destination, 'pip')
- returncode = call([pip, 'install'] + [os.path.abspath(package) for package in packages], env=env)
- if returncode:
- print 'Failure to install packages'
- sys.exit(returncode)
-
-if __name__ == '__main__':
- main()
deleted file mode 100644
--- a/mail/test/resources/jsbridge/MANIFEST.in
+++ /dev/null
@@ -1,2 +0,0 @@
-recursive-include jsbridge/extension *
-recursive-include jsbridge/xpi *
deleted file mode 100644
--- a/mail/test/resources/jsbridge/jsbridge/__init__.py
+++ /dev/null
@@ -1,181 +0,0 @@
-# ***** BEGIN LICENSE BLOCK *****
-# Version: MPL 1.1/GPL 2.0/LGPL 2.1
-#
-# The contents of this file are subject to the Mozilla Public License Version
-# 1.1 (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-# http://www.mozilla.org/MPL/
-#
-# Software distributed under the License is distributed on an "AS IS" basis,
-# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-# for the specific language governing rights and limitations under the
-# License.
-#
-# The Original Code is Mozilla Corporation Code.
-#
-# The Initial Developer of the Original Code is
-# Mikeal Rogers.
-# Portions created by the Initial Developer are Copyright (C) 2008 -2009
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-# Mikeal Rogers <mikeal.rogers@gmail.com>
-# Henrik Skupin <hskupin@mozilla.com>
-#
-# Alternatively, the contents of this file may be used under the terms of
-# either the GNU General Public License Version 2 or later (the "GPL"), or
-# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-# in which case the provisions of the GPL or the LGPL are applicable instead
-# of those above. If you wish to allow use of your version of this file only
-# under the terms of either the GPL or the LGPL, and not to allow others to
-# use your version of this file under the terms of the MPL, indicate your
-# decision by deleting the provisions above and replace them with the notice
-# and other provisions required by the GPL or the LGPL. If you do not delete
-# the provisions above, a recipient may use your version of this file under
-# the terms of any one of the MPL, the GPL or the LGPL.
-#
-# ***** END LICENSE BLOCK *****
-
-import socket
-import os
-import copy
-import asyncore
-
-from time import sleep
-from network import Bridge, BackChannel, create_network
-from jsobjects import JSObject
-
-import mozrunner
-
-settings_env = 'JSBRIDGE_SETTINGS_FILE'
-
-parent = os.path.abspath(os.path.dirname(__file__))
-extension_path = os.path.join(parent, 'extension')
-
-window_string = "Components.classes['@mozilla.org/appshell/window-mediator;1'].getService(Components.interfaces.nsIWindowMediator).getMostRecentWindow('')"
-
-wait_to_create_timeout = 60
-
-def wait_and_create_network(host, port, timeout=wait_to_create_timeout):
- ttl = 0
- while ttl < timeout:
- try:
- s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- s.connect((host, port))
- s.close()
- break
- except socket.error:
- pass
- sleep(.25)
- ttl += .25
- if ttl == timeout:
- raise Exception("Sorry, cannot connect to jsbridge extension, port %s" % port)
-
- back_channel, bridge = create_network(host, port)
- sleep(.5)
-
- while back_channel.registered is False:
- back_channel.close()
- bridge.close()
- asyncore.socket_map = {}
- sleep(1)
- back_channel, bridge = create_network(host, port)
-
- return back_channel, bridge
-
-class CLI(mozrunner.CLI):
- """Command line interface."""
-
- module = "jsbridge"
-
- parser_options = copy.copy(mozrunner.CLI.parser_options)
- parser_options[('-D', '--debug',)] = dict(dest="debug",
- action="store_true",
- help="Debug mode",
- metavar="JSBRIDGE_DEBUG",
- default=False )
- parser_options[('-s', '--shell',)] = dict(dest="shell",
- action="store_true",
- help="Start a Python shell",
- metavar="JSBRIDGE_SHELL",
- default=False )
- parser_options[('-u', '--usecode',)] = dict(dest="usecode", action="store_true",
- help="Use code module instead of iPython",
- default=False)
- parser_options[('-P', '--port')] = dict(dest="port", default="24242",
- help="TCP port to run jsbridge on.")
-
- def get_profile(self, *args, **kwargs):
- if self.options.debug:
- kwargs.setdefault('preferences', {}).update({
- 'extensions.checkCompatibility':False,
- 'devtools.errorconsole.enabled':True,
- 'javascript.options.strict': True
- })
- profile = mozrunner.CLI.get_profile(self, *args, **kwargs)
- profile.install_addon(extension_path)
- return profile
-
- def get_runner(self, *args, **kwargs):
- runner = super(CLI, self).get_runner(*args, **kwargs)
- if self.options.debug:
- runner.cmdargs.append('-jsconsole')
- if not '-jsbridge' in runner.cmdargs:
- runner.cmdargs += ['-jsbridge', self.options.port]
- return runner
-
- def run(self):
- runner = self.create_runner()
- runner.start()
- self.start_jsbridge_network()
- if self.options.shell:
- self.start_shell(runner)
- else:
- try:
- runner.wait()
- except KeyboardInterrupt:
- runner.stop()
-
- runner.profile.cleanup()
-
- def start_shell(self, runner):
- try:
- import IPython
- except:
- IPython = None
- if not hasattr(self, 'bridge'):
- self.start_jsbridge_network()
- jsobj = JSObject(self.bridge, window_string)
-
- if IPython is None or self.options.usecode:
- import code
- code.interact(local={"jsobj":jsobj,
- "getBrowserWindow":lambda : getBrowserWindow(self.bridge),
- "back_channel":self.back_channel,
- })
- else:
- from IPython.Shell import IPShellEmbed
- ipshell = IPShellEmbed([])
- ipshell(local_ns={"jsobj":jsobj,
- "getBrowserWindow":lambda : getBrowserWindow(self.bridge),
- "back_channel":self.back_channel,
- })
- runner.stop()
-
- def start_jsbridge_network(self, timeout=10):
- port = int(self.options.port)
- host = '127.0.0.1'
- self.back_channel, self.bridge = wait_and_create_network(host, port, timeout)
-
-def cli():
- CLI().run()
-
-def getBrowserWindow(bridge):
- return JSObject(bridge, "Components.classes['@mozilla.org/appshell/window-mediator;1'].getService(Components.interfaces.nsIWindowMediator).getMostRecentWindow('')")
-
-
-
-
-
-
-
deleted file mode 100644
--- a/mail/test/resources/jsbridge/jsbridge/extension/chrome.manifest
+++ /dev/null
@@ -1,14 +0,0 @@
-resource jsbridge resource/
-
-content jsbridge chrome/content/
-
-overlay chrome://browser/content/browser.xul chrome://jsbridge/content/overlay.xul
-overlay chrome://messenger/content/mailWindowOverlay.xul chrome://jsbridge/content/overlay.xul
-
-overlay chrome://calendar/content/calendar.xul chrome://jsbridge/content/overlay.xul
-
-overlay windowtype:Songbird:Main chrome://jsbridge/content/overlay.xul
-
-component {2872d428-14f6-11de-ac86-001f5bd9235c} components/cmdarg.js
-contract @mozilla.org/commandlinehandler/general-startup;1?type=jsbridge {2872d428-14f6-11de-ac86-001f5bd9235c}
-category command-line-handler jsbridge @mozilla.org/commandlinehandler/general-startup;1?type=jsbridge
deleted file mode 100644
--- a/mail/test/resources/jsbridge/jsbridge/extension/chrome/content/overlay.js
+++ /dev/null
@@ -1,40 +0,0 @@
-// ***** BEGIN LICENSE BLOCK *****
-// Version: MPL 1.1/GPL 2.0/LGPL 2.1
-//
-// The contents of this file are subject to the Mozilla Public License Version
-// 1.1 (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-// http://www.mozilla.org/MPL/
-//
-// Software distributed under the License is distributed on an "AS IS" basis,
-// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-// for the specific language governing rights and limitations under the
-// License.
-//
-// The Original Code is Mozilla Corporation Code.
-//
-// The Initial Developer of the Original Code is
-// Mikeal Rogers.
-// Portions created by the Initial Developer are Copyright (C) 2008
-// the Initial Developer. All Rights Reserved.
-//
-// Contributor(s):
-// Mikeal Rogers <mikeal.rogers@gmail.com>
-//
-// Alternatively, the contents of this file may be used under the terms of
-// either the GNU General Public License Version 2 or later (the "GPL"), or
-// the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-// in which case the provisions of the GPL or the LGPL are applicable instead
-// of those above. If you wish to allow use of your version of this file only
-// under the terms of either the GPL or the LGPL, and not to allow others to
-// use your version of this file under the terms of the MPL, indicate your
-// decision by deleting the provisions above and replace them with the notice
-// and other provisions required by the GPL or the LGPL. If you do not delete
-// the provisions above, a recipient may use your version of this file under
-// the terms of any one of the MPL, the GPL or the LGPL.
-//
-// ***** END LICENSE BLOCK *****
-
-var jsbridgeInit = {}; Components.utils.import('resource://jsbridge/modules/init.js',jsbridgeInit);
-
-
deleted file mode 100644
--- a/mail/test/resources/jsbridge/jsbridge/extension/chrome/content/overlay.xul
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0"?>
-<overlay id="jsbridge-overlay"
- xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
- <script src="overlay.js"/>
-</overlay>
deleted file mode 100644
--- a/mail/test/resources/jsbridge/jsbridge/extension/components/cmdarg.js
+++ /dev/null
@@ -1,124 +0,0 @@
-Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
-
-const nsIAppShellService = Components.interfaces.nsIAppShellService;
-const nsISupports = Components.interfaces.nsISupports;
-const nsICategoryManager = Components.interfaces.nsICategoryManager;
-const nsIComponentRegistrar = Components.interfaces.nsIComponentRegistrar;
-const nsICommandLine = Components.interfaces.nsICommandLine;
-const nsICommandLineHandler = Components.interfaces.nsICommandLineHandler;
-const nsIFactory = Components.interfaces.nsIFactory;
-const nsIModule = Components.interfaces.nsIModule;
-const nsIWindowWatcher = Components.interfaces.nsIWindowWatcher;
-
-// CHANGEME: to the chrome URI of your extension or application
-const CHROME_URI = "chrome://jsbridge/content/";
-
-// CHANGEME: change the contract id, CID, and category to be unique
-// to your application.
-const clh_contractID = "@mozilla.org/commandlinehandler/general-startup;1?type=jsbridge";
-
-// use uuidgen to generate a unique ID
-const clh_CID = Components.ID("{2872d428-14f6-11de-ac86-001f5bd9235c}");
-
-// category names are sorted alphabetically. Typical command-line handlers use a
-// category that begins with the letter "m".
-const clh_category = "jsbridge";
-
-var aConsoleService = Components.classes["@mozilla.org/consoleservice;1"].
- getService(Components.interfaces.nsIConsoleService);
-
-/**
- * Utility functions
- */
-
-/**
- * Opens a chrome window.
- * @param aChromeURISpec a string specifying the URI of the window to open.
- * @param aArgument an argument to pass to the window (may be null)
- */
-function openWindow(aChromeURISpec, aArgument)
-{
- var ww = Components.classes["@mozilla.org/embedcomp/window-watcher;1"].
- getService(Components.interfaces.nsIWindowWatcher);
- ww.openWindow(null, aChromeURISpec, "_blank",
- "chrome,menubar,toolbar,status,resizable,dialog=no",
- aArgument);
-}
-
-/**
- * The XPCOM component that implements nsICommandLineHandler.
- * It also implements nsIFactory to serve as its own singleton factory.
- */
-function jsbridgeHandler() {
-}
-jsbridgeHandler.prototype = {
- classID: clh_CID,
- contractID: clh_contractID,
- classDescription: "jsbridgeHandler",
- _xpcom_categories: [{category: "command-line-handler", entry: clh_category}],
-
- /* nsISupports */
- QueryInterface : function clh_QI(iid)
- {
- if (iid.equals(nsICommandLineHandler) ||
- iid.equals(nsIFactory) ||
- iid.equals(nsISupports))
- return this;
-
- throw Components.results.NS_ERROR_NO_INTERFACE;
- },
-
- /* nsICommandLineHandler */
-
- handle : function clh_handle(cmdLine)
- {
- try {
- var port = cmdLine.handleFlagWithParam("jsbridge", false);
- if (port) {
- var server = {};
- Components.utils.import('resource://jsbridge/modules/server.js', server);
- server.startServer(parseInt(port));
- } else {
- var server = {};
- Components.utils.import('resource://jsbridge/modules/server.js', server);
- server.startServer(24242);
- }
- }
- catch (e) {
- Components.utils.reportError("incorrect parameter passed to -jsbridge on the command line.");
- }
-
- },
-
- // CHANGEME: change the help info as appropriate, but
- // follow the guidelines in nsICommandLineHandler.idl
- // specifically, flag descriptions should start at
- // character 24, and lines should be wrapped at
- // 72 characters with embedded newlines,
- // and finally, the string should end with a newline
- helpInfo : " -jsbridge Port to run jsbridge on.\n",
-
- /* nsIFactory */
-
- createInstance : function clh_CI(outer, iid)
- {
- if (outer != null)
- throw Components.results.NS_ERROR_NO_AGGREGATION;
-
- return this.QueryInterface(iid);
- },
-
- lockFactory : function clh_lock(lock)
- {
- /* no-op */
- }
-};
-
-/**
- * XPCOMUtils.generateNSGetFactory was introduced in Mozilla 2 (Firefox 4).
- * XPCOMUtils.generateNSGetModule is for Mozilla 1.9.1 (Firefox 3.5).
- */
-if (XPCOMUtils.generateNSGetFactory)
- const NSGetFactory = XPCOMUtils.generateNSGetFactory([jsbridgeHandler]);
-else
- const NSGetModule = XPCOMUtils.generateNSGetModule([jsbridgeHandler]);
deleted file mode 100644
--- a/mail/test/resources/jsbridge/jsbridge/extension/install.rdf
+++ /dev/null
@@ -1,61 +0,0 @@
-<?xml version="1.0"?>
-<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- xmlns:em="http://www.mozilla.org/2004/em-rdf#">
- <Description about="urn:mozilla:install-manifest">
- <em:id>jsbridge@mozilla.com</em:id>
- <em:name>jsbridge</em:name>
- <em:version>2.4.4b4</em:version>
- <em:creator>Mikeal Rogers</em:creator>
- <em:description>Python to JavaScript bridge</em:description>
- <em:unpack>true</em:unpack>
- <em:targetApplication>
- <!-- Firefox -->
- <Description>
- <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
- <em:minVersion>3.5</em:minVersion>
- <em:maxVersion>7.*</em:maxVersion>
- </Description>
- </em:targetApplication>
- <em:targetApplication>
- <!-- Thunderbird -->
- <Description>
- <em:id>{3550f703-e582-4d05-9a08-453d09bdfdc6}</em:id>
- <em:minVersion>3.0a1pre</em:minVersion>
- <em:maxVersion>6.*</em:maxVersion>
- </Description>
- </em:targetApplication>
- <em:targetApplication>
- <!-- Sunbird -->
- <Description>
- <em:id>{718e30fb-e89b-41dd-9da7-e25a45638b28}</em:id>
- <em:minVersion>1.0b1pre</em:minVersion>
- <em:maxVersion>1.0pre</em:maxVersion>
- </Description>
- </em:targetApplication>
- <em:targetApplication>
- <!-- SeaMonkey -->
- <Description>
- <em:id>{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}</em:id>
- <em:minVersion>2.0a1</em:minVersion>
- <em:maxVersion>3.*</em:maxVersion>
- </Description>
- </em:targetApplication>
- <em:targetApplication>
- <!-- Songbird -->
- <Description>
- <em:id>songbird@songbirdnest.com</em:id>
- <em:minVersion>0.3pre</em:minVersion>
- <em:maxVersion>2.*</em:maxVersion>
- </Description>
- </em:targetApplication>
- <em:targetApplication>
- <Description>
- <em:id>toolkit@mozilla.org</em:id>
- <em:minVersion>1.9.1</em:minVersion>
- <em:maxVersion>2.0*</em:maxVersion>
- </Description>
- </em:targetApplication>
- </Description>
-
-
-</RDF>
deleted file mode 100644
--- a/mail/test/resources/jsbridge/jsbridge/extension/resource/modules/events.js
+++ /dev/null
@@ -1,13 +0,0 @@
-var EXPORTED_SYMBOLS = ["backchannels", "fireEvent", "addBackChannel"];
-
-var backchannels = [];
-
-var fireEvent = function (name, obj) {
- for each(backchannel in backchannels) {
- backchannel.session.encodeOut({'eventType':name, 'result':obj});
- }
-}
-
-var addBackChannel = function (backchannel) {
- backchannels.push(backchannel);
-}
deleted file mode 100644
--- a/mail/test/resources/jsbridge/jsbridge/extension/resource/modules/init.js
+++ /dev/null
@@ -1,40 +0,0 @@
-// ***** BEGIN LICENSE BLOCK *****
-// Version: MPL 1.1/GPL 2.0/LGPL 2.1
-//
-// The contents of this file are subject to the Mozilla Public License Version
-// 1.1 (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-// http://www.mozilla.org/MPL/
-//
-// Software distributed under the License is distributed on an "AS IS" basis,
-// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-// for the specific language governing rights and limitations under the
-// License.
-//
-// The Original Code is Mozilla Corporation Code.
-//
-// The Initial Developer of the Original Code is
-// Mikeal Rogers.
-// Portions created by the Initial Developer are Copyright (C) 2008
-// the Initial Developer. All Rights Reserved.
-//
-// Contributor(s):
-// Mikeal Rogers <mikeal.rogers@gmail.com>
-//
-// Alternatively, the contents of this file may be used under the terms of
-// either the GNU General Public License Version 2 or later (the "GPL"), or
-// the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-// in which case the provisions of the GPL or the LGPL are applicable instead
-// of those above. If you wish to allow use of your version of this file only
-// under the terms of either the GPL or the LGPL, and not to allow others to
-// use your version of this file under the terms of the MPL, indicate your
-// decision by deleting the provisions above and replace them with the notice
-// and other provisions required by the GPL or the LGPL. If you do not delete
-// the provisions above, a recipient may use your version of this file under
-// the terms of any one of the MPL, the GPL or the LGPL.
-//
-// ***** END LICENSE BLOCK *****
-
-var EXPORTED_SYMBOLS = ["server"];
-
-var server = {}; Components.utils.import('resource://jsbridge/modules/server.js', server);
deleted file mode 100644
--- a/mail/test/resources/jsbridge/jsbridge/extension/resource/modules/json2.js
+++ /dev/null
@@ -1,471 +0,0 @@
-/*
- http://www.JSON.org/json2.js
- 2008-05-25
-
- Public Domain.
-
- NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
-
- See http://www.JSON.org/js.html
-
- This file creates a global JSON object containing two methods: stringify
- and parse.
-
- JSON.stringify(value, replacer, space)
- value any JavaScript value, usually an object or array.
-
- replacer an optional parameter that determines how object
- values are stringified for objects without a toJSON
- method. It can be a function or an array.
-
- space an optional parameter that specifies the indentation
- of nested structures. If it is omitted, the text will
- be packed without extra whitespace. If it is a number,
- it will specify the number of spaces to indent at each
- level. If it is a string (such as '\t' or ' '),
- it contains the characters used to indent at each level.
-
- This method produces a JSON text from a JavaScript value.
-
- When an object value is found, if the object contains a toJSON
- method, its toJSON method will be called and the result will be
- stringified. A toJSON method does not serialize: it returns the
- value represented by the name/value pair that should be serialized,
- or undefined if nothing should be serialized. The toJSON method
- will be passed the key associated with the value, and this will be
- bound to the object holding the key.
-
- For example, this would serialize Dates as ISO strings.
-
- Date.prototype.toJSON = function (key) {
- function f(n) {
- // Format integers to have at least two digits.
- return n < 10 ? '0' + n : n;
- }
-
- return this.getUTCFullYear() + '-' +
- f(this.getUTCMonth() + 1) + '-' +
- f(this.getUTCDate()) + 'T' +
- f(this.getUTCHours()) + ':' +
- f(this.getUTCMinutes()) + ':' +
- f(this.getUTCSeconds()) + 'Z';
- };
-
- You can provide an optional replacer method. It will be passed the
- key and value of each member, with this bound to the containing
- object. The value that is returned from your method will be
- serialized. If your method returns undefined, then the member will
- be excluded from the serialization.
-
- If the replacer parameter is an array, then it will be used to
- select the members to be serialized. It filters the results such
- that only members with keys listed in the replacer array are
- stringified.
-
- Values that do not have JSON representations, such as undefined or
- functions, will not be serialized. Such values in objects will be
- dropped; in arrays they will be replaced with null. You can use
- a replacer function to replace those with JSON values.
- JSON.stringify(undefined) returns undefined.
-
- The optional space parameter produces a stringification of the
- value that is filled with line breaks and indentation to make it
- easier to read.
-
- If the space parameter is a non-empty string, then that string will
- be used for indentation. If the space parameter is a number, then
- the indentation will be that many spaces.
-
- Example:
-
- text = JSON.stringify(['e', {pluribus: 'unum'}]);
- // text is '["e",{"pluribus":"unum"}]'
-
-
- text = JSON.stringify(['e', {pluribus: 'unum'}], null, '\t');
- // text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]'
-
- text = JSON.stringify([new Date()], function (key, value) {
- return this[key] instanceof Date ?
- 'Date(' + this[key] + ')' : value;
- });
- // text is '["Date(---current time---)"]'
-
-
- JSON.parse(text, reviver)
- This method parses a JSON text to produce an object or array.
- It can throw a SyntaxError exception.
-
- The optional reviver parameter is a function that can filter and
- transform the results. It receives each of the keys and values,
- and its return value is used instead of the original value.
- If it returns what it received, then the structure is not modified.
- If it returns undefined then the member is deleted.
-
- Example:
-
- // Parse the text. Values that look like ISO date strings will
- // be converted to Date objects.
-
- myData = JSON.parse(text, function (key, value) {
- var a;
- if (typeof value === 'string') {
- a =
-/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value);
- if (a) {
- return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4],
- +a[5], +a[6]));
- }
- }
- return value;
- });
-
- myData = JSON.parse('["Date(09/09/2001)"]', function (key, value) {
- var d;
- if (typeof value === 'string' &&
- value.slice(0, 5) === 'Date(' &&
- value.slice(-1) === ')') {
- d = new Date(value.slice(5, -1));
- if (d) {
- return d;
- }
- }
- return value;
- });
-
-
- This is a reference implementation. You are free to copy, modify, or
- redistribute.
-
- This code should be minified before deployment.
- See http://javascript.crockford.com/jsmin.html
-
- USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO
- NOT CONTROL.
-*/
-
-/*jslint evil: true */
-
-/*global JSON */
-
-/*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", call,
- charCodeAt, getUTCDate, getUTCFullYear, getUTCHours, getUTCMinutes,
- getUTCMonth, getUTCSeconds, hasOwnProperty, join, lastIndex, length,
- parse, propertyIsEnumerable, prototype, push, replace, slice, stringify,
- test, toJSON, toString
-*/
-
-var EXPORTED_SYMBOLS = ["JSON"];
-
-if (!this.JSON) {
-
-// Create a JSON object only if one does not already exist. We create the
-// object in a closure to avoid creating global variables.
-
- JSON = function () {
-
- function f(n) {
- // Format integers to have at least two digits.
- return n < 10 ? '0' + n : n;
- }
-
- Date.prototype.toJSON = function (key) {
-
- return this.getUTCFullYear() + '-' +
- f(this.getUTCMonth() + 1) + '-' +
- f(this.getUTCDate()) + 'T' +
- f(this.getUTCHours()) + ':' +
- f(this.getUTCMinutes()) + ':' +
- f(this.getUTCSeconds()) + 'Z';
- };
-
- var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
- escapeable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
- gap,
- indent,
- meta = { // table of character substitutions
- '\b': '\\b',
- '\t': '\\t',
- '\n': '\\n',
- '\f': '\\f',
- '\r': '\\r',
- '"' : '\\"',
- '\\': '\\\\'
- },
- rep;
-
-
- function quote(string) {
-
-// If the string contains no control characters, no quote characters, and no
-// backslash characters, then we can safely slap some quotes around it.
-// Otherwise we must also replace the offending characters with safe escape
-// sequences.
-
- escapeable.lastIndex = 0;
- return escapeable.test(string) ?
- '"' + string.replace(escapeable, function (a) {
- var c = meta[a];
- if (typeof c === 'string') {
- return c;
- }
- return '\\u' + ('0000' +
- (+(a.charCodeAt(0))).toString(16)).slice(-4);
- }) + '"' :
- '"' + string + '"';
- }
-
-
- function str(key, holder) {
-
-// Produce a string from holder[key].
-
- var i, // The loop counter.
- k, // The member key.
- v, // The member value.
- length,
- mind = gap,
- partial,
- value = holder[key];
-
-// If the value has a toJSON method, call it to obtain a replacement value.
-
- if (value && typeof value === 'object' &&
- typeof value.toJSON === 'function') {
- value = value.toJSON(key);
- }
-
-// If we were called with a replacer function, then call the replacer to
-// obtain a replacement value.
-
- if (typeof rep === 'function') {
- value = rep.call(holder, key, value);
- }
-
-// What happens next depends on the value's type.
-
- switch (typeof value) {
- case 'string':
- return quote(value);
-
- case 'number':
-
-// JSON numbers must be finite. Encode non-finite numbers as null.
-
- return isFinite(value) ? String(value) : 'null';
-
- case 'boolean':
- case 'null':
-
-// If the value is a boolean or null, convert it to a string. Note:
-// typeof null does not produce 'null'. The case is included here in
-// the remote chance that this gets fixed someday.
-
- return String(value);
-
-// If the type is 'object', we might be dealing with an object or an array or
-// null.
-
- case 'object':
-
-// Due to a specification blunder in ECMAScript, typeof null is 'object',
-// so watch out for that case.
-
- if (!value) {
- return 'null';
- }
-
-// Make an array to hold the partial results of stringifying this object value.
-
- gap += indent;
- partial = [];
-
-// If the object has a dontEnum length property, we'll treat it as an array.
-
- if (typeof value.length === 'number' &&
- !(value.propertyIsEnumerable('length'))) {
-
-// The object is an array. Stringify every element. Use null as a placeholder
-// for non-JSON values.
-
- length = value.length;
- for (i = 0; i < length; i += 1) {
- partial[i] = str(i, value) || 'null';
- }
-
-// Join all of the elements together, separated with commas, and wrap them in
-// brackets.
-
- v = partial.length === 0 ? '[]' :
- gap ? '[\n' + gap +
- partial.join(',\n' + gap) + '\n' +
- mind + ']' :
- '[' + partial.join(',') + ']';
- gap = mind;
- return v;
- }
-
-// If the replacer is an array, use it to select the members to be stringified.
-
- if (rep && typeof rep === 'object') {
- length = rep.length;
- for (i = 0; i < length; i += 1) {
- k = rep[i];
- if (typeof k === 'string') {
- v = str(k, value, rep);
- if (v) {
- partial.push(quote(k) + (gap ? ': ' : ':') + v);
- }
- }
- }
- } else {
-
-// Otherwise, iterate through all of the keys in the object.
-
- for (k in value) {
- if (Object.hasOwnProperty.call(value, k)) {
- v = str(k, value, rep);
- if (v) {
- partial.push(quote(k) + (gap ? ': ' : ':') + v);
- }
- }
- }
- }
-
-// Join all of the member texts together, separated with commas,
-// and wrap them in braces.
-
- v = partial.length === 0 ? '{}' :
- gap ? '{\n' + gap + partial.join(',\n' + gap) + '\n' +
- mind + '}' : '{' + partial.join(',') + '}';
- gap = mind;
- return v;
- }
- }
-
-// Return the JSON object containing the stringify and parse methods.
-
- return {
- stringify: function (value, replacer, space) {
-
-// The stringify method takes a value and an optional replacer, and an optional
-// space parameter, and returns a JSON text. The replacer can be a function
-// that can replace values, or an array of strings that will select the keys.
-// A default replacer method can be provided. Use of the space parameter can
-// produce text that is more easily readable.
-
- var i;
- gap = '';
- indent = '';
-
-// If the space parameter is a number, make an indent string containing that
-// many spaces.
-
- if (typeof space === 'number') {
- for (i = 0; i < space; i += 1) {
- indent += ' ';
- }
-
-// If the space parameter is a string, it will be used as the indent string.
-
- } else if (typeof space === 'string') {
- indent = space;
- }
-
-// If there is a replacer, it must be a function or an array.
-// Otherwise, throw an error.
-
- rep = replacer;
- if (replacer && typeof replacer !== 'function' &&
- (typeof replacer !== 'object' ||
- typeof replacer.length !== 'number')) {
- throw new Error('JSON.stringify');
- }
-
-// Make a fake root object containing our value under the key of ''.
-// Return the result of stringifying the value.
-
- return str('', {'': value});
- },
-
-
- parse: function (text, reviver) {
-
-// The parse method takes a text and an optional reviver function, and returns
-// a JavaScript value if the text is a valid JSON text.
-
- var j;
-
- function walk(holder, key) {
-
-// The walk method is used to recursively walk the resulting structure so
-// that modifications can be made.
-
- var k, v, value = holder[key];
- if (value && typeof value === 'object') {
- for (k in value) {
- if (Object.hasOwnProperty.call(value, k)) {
- v = walk(value, k);
- if (v !== undefined) {
- value[k] = v;
- } else {
- delete value[k];
- }
- }
- }
- }
- return reviver.call(holder, key, value);
- }
-
-
-// Parsing happens in four stages. In the first stage, we replace certain
-// Unicode characters with escape sequences. JavaScript handles many characters
-// incorrectly, either silently deleting them, or treating them as line endings.
-
- cx.lastIndex = 0;
- if (cx.test(text)) {
- text = text.replace(cx, function (a) {
- return '\\u' + ('0000' +
- (+(a.charCodeAt(0))).toString(16)).slice(-4);
- });
- }
-
-// In the second stage, we run the text against regular expressions that look
-// for non-JSON patterns. We are especially concerned with '()' and 'new'
-// because they can cause invocation, and '=' because it can cause mutation.
-// But just to be safe, we want to reject all unexpected forms.
-
-// We split the second stage into 4 regexp operations in order to work around
-// crippling inefficiencies in IE's and Safari's regexp engines. First we
-// replace the JSON backslash pairs with '@' (a non-JSON character). Second, we
-// replace all simple value tokens with ']' characters. Third, we delete all
-// open brackets that follow a colon or comma or that begin the text. Finally,
-// we look to see that the remaining characters are only whitespace or ']' or
-// ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval.
-
- if (/^[\],:{}\s]*$/.
-test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@').
-replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']').
-replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
-
-// In the third stage we use the eval function to compile the text into a
-// JavaScript structure. The '{' operator is subject to a syntactic ambiguity
-// in JavaScript: it can begin a block or an object literal. We wrap the text
-// in parens to eliminate the ambiguity.
-
- j = eval('(' + text + ')');
-
-// In the optional fourth stage, we recursively walk the new structure, passing
-// each name/value pair to a reviver function for possible transformation.
-
- return typeof reviver === 'function' ?
- walk({'': j}, '') : j;
- }
-
-// If the text is not JSON parseable, then a SyntaxError is thrown.
-
- throw new SyntaxError('JSON.parse');
- }
- };
- }();
-}
deleted file mode 100644
--- a/mail/test/resources/jsbridge/jsbridge/extension/resource/modules/server.js
+++ /dev/null
@@ -1,347 +0,0 @@
-// ***** BEGIN LICENSE BLOCK *****
-// Version: MPL 1.1/GPL 2.0/LGPL 2.1
-//
-// The contents of this file are subject to the Mozilla Public License Version
-// 1.1 (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-// http://www.mozilla.org/MPL/
-//
-// Software distributed under the License is distributed on an "AS IS" basis,
-// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-// for the specific language governing rights and limitations under the
-// License.
-//
-// The Original Code is Mozilla Corporation Code.
-//
-// The Initial Developer of the Original Code is
-// based on the MozRepl project.
-// Portions created by the Initial Developer are Copyright (C) 2008
-// the Initial Developer. All Rights Reserved.
-//
-// Contributor(s):
-// Mikeal Rogers <mikeal.rogers@gmail.com>
-// Massimiliano Mirra <bard@hyperstruct.net>
-//
-// Alternatively, the contents of this file may be used under the terms of
-// either the GNU General Public License Version 2 or later (the "GPL"), or
-// the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-// in which case the provisions of the GPL or the LGPL are applicable instead
-// of those above. If you wish to allow use of your version of this file only
-// under the terms of either the GPL or the LGPL, and not to allow others to
-// use your version of this file under the terms of the MPL, indicate your
-// decision by deleting the provisions above and replace them with the notice
-// and other provisions required by the GPL or the LGPL. If you do not delete
-// the provisions above, a recipient may use your version of this file under
-// the terms of any one of the MPL, the GPL or the LGPL.
-//
-// ***** END LICENSE BLOCK *****
-
-var EXPORTED_SYMBOLS = ["Server", "server", "AsyncRead", "Session", "sessions", "globalRegistry", "startServer"];
-
-var events = {}; Components.utils.import("resource://jsbridge/modules/events.js", events);
-const DEBUG_ON = false;
-const BUFFER_SIZE = 1024;
-const Cc = Components.classes;
-const Ci = Components.interfaces;
-const loader = Cc['@mozilla.org/moz/jssubscript-loader;1']
- .getService(Ci.mozIJSSubScriptLoader);
-
-var hwindow = Components.classes["@mozilla.org/appshell/appShellService;1"]
- .getService(Components.interfaces.nsIAppShellService)
- .hiddenDOMWindow;
-
-var nativeJSON = Components.classes["@mozilla.org/dom/json;1"]
- .createInstance(Components.interfaces.nsIJSON);
-
-var json2 = Components.utils.import("resource://jsbridge/modules/json2.js");
-
-var jsonEncode = json2.JSON.stringify;
-
-var uuidgen = Components.classes["@mozilla.org/uuid-generator;1"]
- .getService(Components.interfaces.nsIUUIDGenerator);
-
-function AsyncRead (session) {
- this.session = session;
-}
-AsyncRead.prototype.onStartRequest = function (request, context) {};
-AsyncRead.prototype.onStopRequest = function (request, context, status) {
- log("async onstoprequest: onstoprequest");
- this.session.onQuit();
-}
-AsyncRead.prototype.onDataAvailable = function (request, context, inputStream, offset, count) {
- var str = {};
- str.value = '';
-
- var bytesAvail = 0;
- do {
- var parts = {};
- if (count > BUFFER_SIZE) {
- bytesAvail = BUFFER_SIZE;
- } else {
- bytesAvail = count;
- }
-
- log("jsbridge: onDataAvailable, reading bytesAvail = " + bytesAvail + "\n");
- var bytesRead = this.session.instream.readString(bytesAvail, parts);
- count = count - bytesRead;
- log("jsbridge: onDataAvailable, read bytes: " + bytesRead + " count is now: " + count + "\n");
- str.value += parts.value;
- } while (count > 0);
- log("jsbridge: onDataAvailable, going into receive with: \n\n" + str.value + "\n\n");
- this.session.receive(str.value);
-}
-
-
-
-globalRegistry = {};
-
-function Bridge (session) {
- this.session = session;
- this.registry = globalRegistry;
-}
-Bridge.prototype._register = function (_type) {
- this.bridgeType = _type;
- if (_type == "backchannel") {
- events.addBackChannel(this);
- }
-}
-Bridge.prototype.register = function (uuid, _type) {
- try {
- this._register(_type);
- var passed = true;
- } catch(e) {
- if (typeof(e) == "string") {
- var exception = e;
- } else {
- var exception = {'name':e.name, 'message':e.message};
- }
- this.session.encodeOut({'result':false, 'exception':exception, 'uuid':uuid});
- }
- if (passed != undefined) {
- this.session.encodeOut({"result":true, 'eventType':'register', 'uuid':uuid});
- }
-
-}
-Bridge.prototype._describe = function (obj) {
- var response = {};
- if (obj == null) {
- var type = "null";
- } else {
- var type = typeof(obj);
- }
- if (type == "object") {
- if (obj.length != undefined) {
- var type = "array";
- }
- response.attributes = [];
- for (i in obj) {
- response.attributes = response.attributes.concat(i);
- }
- }
- else if (type != "function"){
- response.data = obj;
- }
- response.type = type;
- return response;
-}
-Bridge.prototype.describe = function (uuid, obj) {
- var response = this._describe(obj);
- response.uuid = uuid;
- response.result = true;
- this.session.encodeOut(response);
-}
-Bridge.prototype._set = function (obj) {
- var uuid = uuidgen.generateUUID().toString();
- this.registry[uuid] = obj;
- return uuid;
-}
-Bridge.prototype.set = function (uuid, obj) {
- var ruuid = this._set(obj);
- this.session.encodeOut({'result':true, 'data':'bridge.registry["'+ruuid+'"]', 'uuid':uuid});
-}
-Bridge.prototype._setAttribute = function (obj, name, value) {
- obj[name] = value;
- return value;
-}
-Bridge.prototype.setAttribute = function (uuid, obj, name, value) {
- try {
- var result = this._setAttribute(obj, name, value);
- } catch(e) {
- if (typeof(e) == "string") {
- var exception = e;
- } else {
- var exception = {'name':e.name, 'message':e.message};
- }
- this.session.encodeOut({'result':false, 'exception':exception, 'uuid':uuid});
- }
- if (result != undefined) {
- this.set(uuid, obj[name]);
- }
-}
-Bridge.prototype._execFunction = function (func, args) {
- return func.apply(this.session.sandbox, args);
-}
-Bridge.prototype.execFunction = function (uuid, func, args) {
- try {
- var data = this._execFunction(func, args);
- var result = true;
- } catch(e) {
- if (typeof(e) == "string") {
- var exception = e;
- } else {
- var exception = {'name':e.name, 'message':e.message};
- }
- this.session.encodeOut({'result':false, 'exception':exception, 'uuid':uuid});
- var result = true;
- }
- if (data != undefined) {
- this.set(uuid, data);
- } else if ( result == true) {
- this.session.encodeOut({'result':true, 'data':null, 'uuid':uuid});
- } else {
- log("jsbridge threw unknown data in execFunc");
- throw 'JSBridge unknown data in execFunc';
- }
-}
-
-backstage = this;
-
-function Session (transport) {
- this.transpart = transport;
- this.sandbox = Components.utils.Sandbox(backstage);
- this.sandbox.bridge = new Bridge(this);
- this.sandbox.openPreferences = hwindow.openPreferences;
- try {
- this.outputstream = transport.openOutputStream(Ci.nsITransport.OPEN_BLOCKING, 0, 0);
- this.outstream = Cc['@mozilla.org/intl/converter-output-stream;1']
- .createInstance(Ci.nsIConverterOutputStream);
- this.outstream.init(this.outputstream, 'UTF-8', BUFFER_SIZE,
- Ci.nsIConverterOutputStream.DEFAULT_REPLACEMENT_CHARACTER);
- this.stream = transport.openInputStream(0, 0, 0);
- this.instream = Cc['@mozilla.org/intl/converter-input-stream;1']
- .createInstance(Ci.nsIConverterInputStream);
- this.instream.init(this.stream, 'UTF-8', BUFFER_SIZE,
- Ci.nsIConverterInputStream.DEFAULT_REPLACEMENT_CHARACTER);
- } catch(e) {
- log('jsbridge: Error: ' + e);
- }
- log('jsbridge: Accepted connection.');
-
- this.pump = Cc['@mozilla.org/network/input-stream-pump;1']
- .createInstance(Ci.nsIInputStreamPump);
- this.pump.init(this.stream, -1, -1, 0, 0, false);
- this.pump.asyncRead(new AsyncRead(this), null);
-}
-Session.prototype.onOutput = function(string) {
- log('jsbridge: write: '+string)
- if (typeof(string) != "string") {
- throw "This is not a string"
- }
- try {
- var stroffset = 0;
- do {
- var parts = '';
- // Handle the case where we are writing something larger than our buffer
- if (string.length > BUFFER_SIZE) {
- log("jsbridge: onOutput: writing data stroffset is: " + stroffset + " string.length is: " + string.length);
- parts = string.slice(stroffset, stroffset + BUFFER_SIZE);
- log("jsbridge: onOutput: here is our part: \n" + parts + "\n");
- } else {
- parts = string;
- }
-
- // Update our offset
- stroffset = stroffset += parts.length;
-
- // write it
- this.outstream.writeString(parts);
- } while (stroffset < string.length);
-
- // Ensure the entire stream is flushed
- this.outstream.flush();
- } catch (e) {
- log("jsbridge: threw on writing string: " + string + " exception: " + e);
- throw "JSBridge cannot write: "+string
- }
-};
-Session.prototype.onQuit = function() {
- this.instream.close();
- this.outstream.close();
- sessions.remove(session);
-};
-Session.prototype.encodeOut = function (obj) {
- try {
- this.onOutput(jsonEncode(obj));
- } catch(e) {
- if (typeof(e) == "string") {
- var exception = e;
- } else {
- var exception = {'name':e.name, 'message':e.message};
- }
- this.onOutput(jsonEncode({'result':false, 'exception':exception}));
- }
-
-}
-Session.prototype.receive = function(data) {
- Components.utils.evalInSandbox(data, this.sandbox);
-}
-
-var sessions = {
- _list: [],
- add: function(session) {
- this._list.push(session);
- },
- remove: function(session) {
- var index = this._list.indexOf(session);
- if(index != -1)
- this._list.splice(index, 1);
- },
- get: function(index) {
- return this._list[index];
- },
- quit: function() {
- this._list.forEach(
- function(session) { session.quit; });
- this._list.splice(0, this._list.length);
- }
-};
-
-function Server (port) {
- this.port = port;
-}
-Server.prototype.start = function () {
- try {
- this.serv = Cc['@mozilla.org/network/server-socket;1']
- .createInstance(Ci.nsIServerSocket);
- this.serv.init(this.port, true, -1);
- this.serv.asyncListen(this);
- } catch(e) {
- log('jsbridge: Exception: ' + e);
- }
-}
-Server.prototype.stop = function () {
- log('jsbridge: Closing...');
- this.serv.close();
- this.sessions.quit();
- this.serv = undefined;
-}
-Server.prototype.onStopListening = function (serv, status) {
-// Stub function
-}
-Server.prototype.onSocketAccepted = function (serv, transport) {
- session = new Session(transport)
- sessions.add(session);
-}
-
-function log(msg) {
- if (DEBUG_ON) {
- dump(msg + '\n');
- }
-}
-
-function startServer(port) {
- var server = new Server(port)
- server.start()
-}
-
-
deleted file mode 100644
--- a/mail/test/resources/jsbridge/jsbridge/jsobjects.py
+++ /dev/null
@@ -1,167 +0,0 @@
-# ***** BEGIN LICENSE BLOCK *****
-# Version: MPL 1.1/GPL 2.0/LGPL 2.1
-#
-# The contents of this file are subject to the Mozilla Public License Version
-# 1.1 (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-# http://www.mozilla.org/MPL/
-#
-# Software distributed under the License is distributed on an "AS IS" basis,
-# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-# for the specific language governing rights and limitations under the
-# License.
-#
-# The Original Code is Mozilla Corporation Code.
-#
-# The Initial Developer of the Original Code is
-# Mikeal Rogers.
-# Portions created by the Initial Developer are Copyright (C) 2008
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-# Mikeal Rogers <mikeal.rogers@gmail.com>
-#
-# Alternatively, the contents of this file may be used under the terms of
-# either the GNU General Public License Version 2 or later (the "GPL"), or
-# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-# in which case the provisions of the GPL or the LGPL are applicable instead
-# of those above. If you wish to allow use of your version of this file only
-# under the terms of either the GPL or the LGPL, and not to allow others to
-# use your version of this file under the terms of the MPL, indicate your
-# decision by deleting the provisions above and replace them with the notice
-# and other provisions required by the GPL or the LGPL. If you do not delete
-# the provisions above, a recipient may use your version of this file under
-# the terms of any one of the MPL, the GPL or the LGPL.
-#
-# ***** END LICENSE BLOCK *****
-
-def init_jsobject(cls, bridge, name, value, description=None):
- """Initialize a js object that is a subclassed base type; int, str, unicode, float."""
- obj = cls(value)
- obj._bridge_ = bridge
- obj._name_ = name
- obj._description_ = description
- return obj
-
-def create_jsobject(bridge, fullname, value=None, obj_type=None, override_set=False):
- """Create a single JSObject for named object on other side of the bridge.
-
- Handles various initization cases for different JSObjects."""
- description = bridge.describe(fullname)
- obj_type = description['type']
- value = description.get('data', None)
-
- if value is True or value is False:
- return value
-
- if js_type_cases.has_key(obj_type):
- cls, needs_init = js_type_cases[obj_type]
- # Objects that requires initialization are base types that have "values".
- if needs_init:
- obj = init_jsobject(cls, bridge, fullname, value, description=description)
- else:
- obj = cls(bridge, fullname, description=description, override_set=override_set)
- return obj
- else:
- # Something very bad happened, we don't have a representation for the given type.
- raise TypeError("Don't have a JSObject for javascript type "+obj_type)
-
-class JSObject(object):
- """Base javascript object representation."""
- _loaded_ = False
-
- def __init__(self, bridge, name, override_set=False, description=None, *args, **kwargs):
- self._bridge_ = bridge
- if not override_set:
- name = bridge.set(name)['data']
- self._name_ = name
- self._description_ = description
-
- def __jsget__(self, name):
- """Abstraction for final step in get events; __getitem__ and __getattr__.
- """
- result = create_jsobject(self._bridge_, name, override_set=True)
- return result
-
- def __getattr__(self, name):
- """Get the object from jsbridge.
-
- Handles lazy loading of all attributes of self."""
- # A little hack so that ipython returns all the names.
- if name == '_getAttributeNames':
- return lambda : self._bridge_.describe(self._name_)['attributes']
-
- attributes = self._bridge_.describe(self._name_)['attributes']
- if name in attributes:
- return self.__jsget__(self._name_+'["'+name+'"]')
- else:
- raise AttributeError(name+" is undefined.")
-
- __getitem__ = __getattr__
-
- def __setattr__(self, name, value):
- """Set the given JSObject as an attribute of this JSObject and make proper javascript
- assignment on the other side of the bridge."""
- if name.startswith('_') and name.endswith('_'):
- return object.__setattr__(self, name, value)
-
- response = self._bridge_.setAttribute(self._name_, name, value)
- object.__setattr__(self, name, create_jsobject(self._bridge_, response['data'], override_set=True))
-
- __setitem__ = __setattr__
-
-class JSFunction(JSObject):
- """Javascript function represenation.
-
- Returns a JSObject instance for the serialized js type with
- name set to the full javascript call for this function.
- """
-
- def __init__(self, bridge, name, override_set=False, description=None, *args, **kwargs):
- self._bridge_ = bridge
- self._name_ = name
- self._description_ = description
-
- def __call__(self, *args):
- response = self._bridge_.execFunction(self._name_, args)
- if response['data'] is not None:
- return create_jsobject(self._bridge_, response['data'], override_set=True)
-
-
-class JSString(JSObject, unicode):
- "Javascript string representation."
- __init__ = unicode.__init__
-
-class JSInt(JSObject, int):
- """Javascript number representation for Python int."""
- __init__ = int.__init__
-
-class JSFloat(JSObject, float):
- """Javascript number representation for Python float."""
- __init__ = float.__init__
-
-class JSUndefined(JSObject):
- """Javascript undefined representation."""
- __str__ = lambda self : "undefined"
-
- def __cmp__(self, other):
- if isinstance(other, JSUndefined):
- return True
- else:
- return False
-
- __nonzero__ = lambda self: False
-
-js_type_cases = {'function' :(JSFunction, False,),
- 'object' :(JSObject, False,),
- 'array' :(JSObject, False,),
- 'string' :(JSString, True,),
- 'number' :(JSFloat, True,),
- 'undefined':(JSUndefined, False,),
- 'null' :(JSObject, False,),
- }
-py_type_cases = {unicode :JSString,
- str :JSString,
- int :JSInt,
- float :JSFloat,
- }
deleted file mode 100644
--- a/mail/test/resources/jsbridge/jsbridge/network.py
+++ /dev/null
@@ -1,308 +0,0 @@
-# ***** BEGIN LICENSE BLOCK *****
-# Version: MPL 1.1/GPL 2.0/LGPL 2.1
-#
-# The contents of this file are subject to the Mozilla Public License Version
-# 1.1 (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-# http://www.mozilla.org/MPL/
-#
-# Software distributed under the License is distributed on an "AS IS" basis,
-# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-# for the specific language governing rights and limitations under the
-# License.
-#
-# The Original Code is Mozilla Corporation Code.
-#
-# The Initial Developer of the Original Code is
-# Mikeal Rogers.
-# Portions created by the Initial Developer are Copyright (C) 2008
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-# Mikeal Rogers <mikeal.rogers@gmail.com>
-#
-# Alternatively, the contents of this file may be used under the terms of
-# either the GNU General Public License Version 2 or later (the "GPL"), or
-# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-# in which case the provisions of the GPL or the LGPL are applicable instead
-# of those above. If you wish to allow use of your version of this file only
-# under the terms of either the GPL or the LGPL, and not to allow others to
-# use your version of this file under the terms of the MPL, indicate your
-# decision by deleting the provisions above and replace them with the notice
-# and other provisions required by the GPL or the LGPL. If you do not delete
-# the provisions above, a recipient may use your version of this file under
-# the terms of any one of the MPL, the GPL or the LGPL.
-#
-# ***** END LICENSE BLOCK *****
-
-import asyncore
-import socket
-import select
-import logging
-import uuid
-from time import sleep
-from threading import Thread
-
-try:
- import json as simplejson
- from json.encoder import encode_basestring_ascii, encode_basestring
-except ImportError:
- import simplejson
- from simplejson.encoder import encode_basestring_ascii, encode_basestring
-
-logger = logging.getLogger(__name__)
-
-class JavaScriptException(Exception): pass
-
-class Telnet(asyncore.dispatcher):
- def __init__(self, host, port):
- self.host, self.port = host, port
- asyncore.dispatcher.__init__(self)
- self.create_socket(socket.AF_INET, socket.SOCK_STREAM)
- self.connect((host, port))
- self.buffer = ''
- self.logger = logger
-
- def __del__(self):
- self.close()
-
- def handle_close(self):
- """override method of asyncore.dispatcher"""
- self.close()
-
- def handle_expt(self):
- self.close() # connection failed, shutdown
-
- def writable(self):
- return (len(self.buffer) > 0)
-
- def handle_write(self):
- sent = self.send(self.buffer)
- self.buffer = self.buffer[sent:]
-
- def read_all(self):
- import socket
- data = ''
- while 1:
- try:
- data += self.recv(4096)
- except socket.error:
- return data
-
- def handle_read(self):
- self.data = self.read_all()
- self.process_read(self.data)
-
-
- read_callback = lambda self, data: None
-
-decoder = simplejson.JSONDecoder()
-
-class JSObjectEncoder(simplejson.JSONEncoder):
- """Encoder that supports jsobject references by name."""
-
- def encode(self, o):
- import jsobjects
- if isinstance(o, jsobjects.JSObject):
- return o._name_
- else:
- return simplejson.JSONEncoder.encode(self, o)
-
- def _iterencode(self, o, markers=None):
- import jsobjects
- if isinstance(o, jsobjects.JSObject):
- yield o._name_
- elif isinstance(o, basestring):
- if self.ensure_ascii:
- encoder = encode_basestring_ascii
- else:
- encoder = encode_basestring
- _encoding = self.encoding
- if (_encoding is not None and isinstance(o, str)
- and not (_encoding == 'utf-8')):
- o = o.decode(_encoding)
- yield encoder(o)
- elif o is None:
- yield 'null'
- elif o is True:
- yield 'true'
- elif o is False:
- yield 'false'
- elif isinstance(o, (int, long)):
- yield str(o)
- elif isinstance(o, float):
- yield getattr(simplejson.encoder, 'floatstr', simplejson.encoder._floatstr)(o, self.allow_nan)
- elif isinstance(o, (list, tuple)):
- for chunk in self._iterencode_list(o, markers):
- yield chunk
- elif isinstance(o, dict):
- for chunk in self._iterencode_dict(o, markers):
- yield chunk
- else:
- if markers is not None:
- markerid = id(o)
- if markerid in markers:
- raise ValueError("Circular reference detected")
- markers[markerid] = o
- for chunk in self._iterencode_default(o, markers):
- yield chunk
- if markers is not None:
- del markers[markerid]
-
-encoder = JSObjectEncoder()
-
-class JSBridgeDisconnectError(Exception):
- """exception raised when an unexpected disconect happens"""
-
-
-class Bridge(Telnet):
-
- trashes = []
- reading = False
- sbuffer = ''
- events_list = []
-
- callbacks = {}
-
- bridge_type = "bridge"
-
- registered = False
- timeout_ctr = 0. # global timeout counter
-
- def __init__(self, host, port, timeout=60.):
- """
- - timeout : failsafe timeout for each call to run in seconds
- """
- self.timeout = timeout
- Telnet.__init__(self, host, port)
- sleep(.1)
-
- # XXX we've actually already connected in Telnet
- self.connect((host, port))
-
- def handle_connect(self):
- self.register()
-
- def run(self, _uuid, exec_string, interval=.2, raise_exeption=True):
-
-
- exec_string += '\r\n'
- self.send(exec_string)
-
- while _uuid not in self.callbacks.keys():
-
- Bridge.timeout_ctr += interval
- if Bridge.timeout_ctr > self.timeout:
- print 'Timeout: %s' % exec_string
- raise JSBridgeDisconnectError("Connection timed out")
-
- sleep(interval)
- try:
- self.send('')
- except socket.error, e:
- raise JSBridgeDisconnectError("JSBridge Socket Disconnected: %s" % e)
-
- Bridge.timeout_ctr = 0. # reset the counter
-
- callback = self.callbacks.pop(_uuid)
- if callback['result'] is False and raise_exeption is True:
- raise JavaScriptException(callback['exception'])
- return callback
-
- def register(self):
- _uuid = str(uuid.uuid1())
- self.send('bridge.register("'+_uuid+'", "'+self.bridge_type+'")\r\n')
- self.registered = True
-
- def execFunction(self, func_name, args, interval=.25):
- _uuid = str(uuid.uuid1())
- exec_args = [encoder.encode(_uuid), func_name, encoder.encode(args)]
- return self.run(_uuid, 'bridge.execFunction('+ ', '.join(exec_args)+')', interval)
-
- def setAttribute(self, obj_name, name, value):
- _uuid = str(uuid.uuid1())
- exec_args = [encoder.encode(_uuid), obj_name, encoder.encode(name), encoder.encode(value)]
- return self.run(_uuid, 'bridge.setAttribute('+', '.join(exec_args)+')')
-
- def set(self, obj_name):
- _uuid = str(uuid.uuid1())
- return self.run(_uuid, 'bridge.set('+', '.join([encoder.encode(_uuid), obj_name])+')')
-
- def describe(self, obj_name):
- _uuid = str(uuid.uuid1())
- return self.run(_uuid, 'bridge.describe('+', '.join([encoder.encode(_uuid), obj_name])+')')
-
- def fire_callbacks(self, obj):
- self.callbacks[obj['uuid']] = obj
-
- def process_read(self, data):
- """Parse out json objects and fire callbacks."""
- self.sbuffer += data
- self.reading = True
- self.parsing = True
- while self.parsing:
- # Remove erroneus data in front of callback object
- index = self.sbuffer.find('{')
- if index is not -1 and index is not 0:
- self.sbuffer = self.sbuffer[index:]
- # Try to get a json object from the data stream
- try:
- obj, index = decoder.raw_decode(self.sbuffer)
- except Exception, e:
- self.parsing = False
- # If we got an object fire the callback infra
- if self.parsing:
- self.fire_callbacks(obj)
- self.sbuffer = self.sbuffer[index:]
-
-class BackChannel(Bridge):
-
- bridge_type = "backchannel"
-
- def __init__(self, host, port):
- Bridge.__init__(self, host, port)
- self.uuid_listener_index = {}
- self.event_listener_index = {}
- self.global_listeners = []
-
- def fire_callbacks(self, obj):
- """Handle all callback fireing on json objects pulled from the data stream."""
- self.fire_event(**dict([(str(key), value,) for key, value in obj.items()]))
-
- def add_listener(self, callback, uuid=None, eventType=None):
- if uuid is not None:
- self.uuid_listener_index.setdefault(uuid, []).append(callback)
- if eventType is not None:
- self.event_listener_index.setdefault(eventType, []).append(callback)
-
- def add_global_listener(self, callback):
- self.global_listeners.append(callback)
-
- def fire_event(self, eventType=None, uuid=None, result=None, exception=None):
- Bridge.timeout_ctr = 0. # reset the counter
- event = eventType
- if uuid is not None and self.uuid_listener_index.has_key(uuid):
- for callback in self.uuid_listener_index[uuid]:
- callback(result)
- if event is not None and self.event_listener_index.has_key(event):
- for callback in self.event_listener_index[event]:
- callback(result)
- for listener in self.global_listeners:
- listener(eventType, result)
-
-thread = None
-
-def create_network(hostname, port):
- back_channel = BackChannel(hostname, port)
- bridge = Bridge(hostname, port)
- global thread
- if not thread or not thread.isAlive():
- def do():
- try: asyncore.loop(use_poll=True)
- except select.error:pass
-
- thread = Thread(target=do)
- getattr(thread, 'setDaemon', lambda x : None)(True)
- thread.start()
-
- return back_channel, bridge
deleted file mode 100644
--- a/mail/test/resources/jsbridge/setup.py
+++ /dev/null
@@ -1,77 +0,0 @@
-# ***** BEGIN LICENSE BLOCK *****
-# Version: MPL 1.1/GPL 2.0/LGPL 2.1
-#
-# The contents of this file are subject to the Mozilla Public License Version
-# 1.1 (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-# http://www.mozilla.org/MPL/
-#
-# Software distributed under the License is distributed on an "AS IS" basis,
-# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-# for the specific language governing rights and limitations under the
-# License.
-#
-# The Original Code is Mozilla Corporation Code.
-#
-# The Initial Developer of the Original Code is
-# Mikeal Rogers.
-# Portions created by the Initial Developer are Copyright (C) 2008
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-# Mikeal Rogers <mikeal.rogers@gmail.com>
-#
-# Alternatively, the contents of this file may be used under the terms of
-# either the GNU General Public License Version 2 or later (the "GPL"), or
-# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-# in which case the provisions of the GPL or the LGPL are applicable instead
-# of those above. If you wish to allow use of your version of this file only
-# under the terms of either the GPL or the LGPL, and not to allow others to
-# use your version of this file under the terms of the MPL, indicate your
-# decision by deleting the provisions above and replace them with the notice
-# and other provisions required by the GPL or the LGPL. If you do not delete
-# the provisions above, a recipient may use your version of this file under
-# the terms of any one of the MPL, the GPL or the LGPL.
-#
-# ***** END LICENSE BLOCK *****
-
-import sys
-from setuptools import setup, find_packages
-
-desc = """Python to JavaScript bridge interface."""
-summ = """A powerful and extensible Python to JavaScript bridge interface."""
-
-PACKAGE_NAME = "jsbridge"
-PACKAGE_VERSION = "2.4.4b4"
-
-requires = ['mozrunner == 2.5.5b4']
-
-if not sys.version.startswith('2.6'):
- requires.append('simplejson')
-
-setup(name=PACKAGE_NAME,
- version=PACKAGE_VERSION,
- description=desc,
- long_description=summ,
- author='Mikeal Rogers, Mozilla',
- author_email='mikeal.rogers@gmail.com',
- url='http://github.com/mozautomation/mozmill',
- license='http://www.apache.org/licenses/LICENSE-2.0',
- packages=find_packages(exclude=['test']),
- include_package_data=True,
- package_data = {'': ['*.js', '*.css', '*.html', '*.txt', '*.xpi', '*.rdf', '*.xul', '*.jsm', '*.xml' 'extension'],},
- zip_safe=False,
- entry_points="""
- [console_scripts]
- jsbridge = jsbridge:cli
- """,
- platforms =['Any'],
- install_requires = requires,
- classifiers=['Development Status :: 4 - Beta',
- 'Environment :: Console',
- 'Intended Audience :: Developers',
- 'License :: OSI Approved :: Apache Software License',
- 'Operating System :: OS Independent',
- 'Topic :: Software Development :: Libraries :: Python Modules',
- ]
- )
deleted file mode 100644
--- a/mail/test/resources/mozmill/MANIFEST.in
+++ /dev/null
@@ -1,2 +0,0 @@
-recursive-include docs *
-recursive-include mozmill/extension *
deleted file mode 100644
--- a/mail/test/resources/mozmill/docs/Makefile
+++ /dev/null
@@ -1,75 +0,0 @@
-# Makefile for Sphinx documentation
-#
-
-# You can set these variables from the command line.
-SPHINXOPTS =
-SPHINXBUILD = sphinx-build
-PAPER =
-
-# Internal variables.
-PAPEROPT_a4 = -D latex_paper_size=a4
-PAPEROPT_letter = -D latex_paper_size=letter
-ALLSPHINXOPTS = -d _build/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
-
-.PHONY: help clean html web pickle htmlhelp latex changes linkcheck
-
-help:
- @echo "Please use \`make <target>' where <target> is one of"
- @echo " html to make standalone HTML files"
- @echo " pickle to make pickle files"
- @echo " json to make JSON files"
- @echo " htmlhelp to make HTML files and a HTML help project"
- @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
- @echo " changes to make an overview over all changed/added/deprecated items"
- @echo " linkcheck to check all external links for integrity"
-
-clean:
- -rm -rf _build/*
-
-html:
- mkdir -p _build/html _build/doctrees
- $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) _build/html
- @echo
- @echo "Build finished. The HTML pages are in _build/html."
-
-pickle:
- mkdir -p _build/pickle _build/doctrees
- $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) _build/pickle
- @echo
- @echo "Build finished; now you can process the pickle files."
-
-web: pickle
-
-json:
- mkdir -p _build/json _build/doctrees
- $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) _build/json
- @echo
- @echo "Build finished; now you can process the JSON files."
-
-htmlhelp:
- mkdir -p _build/htmlhelp _build/doctrees
- $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) _build/htmlhelp
- @echo
- @echo "Build finished; now you can run HTML Help Workshop with the" \
- ".hhp project file in _build/htmlhelp."
-
-latex:
- mkdir -p _build/latex _build/doctrees
- $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) _build/latex
- @echo
- @echo "Build finished; the LaTeX files are in _build/latex."
- @echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \
- "run these through (pdf)latex."
-
-changes:
- mkdir -p _build/changes _build/doctrees
- $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) _build/changes
- @echo
- @echo "The overview file is in _build/changes."
-
-linkcheck:
- mkdir -p _build/linkcheck _build/doctrees
- $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) _build/linkcheck
- @echo
- @echo "Link check complete; look for any errors in the above output " \
- "or in _build/linkcheck/output.txt."
deleted file mode 100644
index e86b37588750230abe690cd9488c6c38fb5ad607..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index 15c791446ca392f54af3299a84533327f8b95dc3..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
--- a/mail/test/resources/mozmill/docs/_build/html/_sources/index.txt
+++ /dev/null
@@ -1,188 +0,0 @@
-:mod:`mozmill` --- Full automation of XULRunner applications.
-=============================================================
-
-.. module:: mozmill
- :synopsis: Full automation of XULRunner applications.
-.. moduleauthor:: Mikeal Rogers <mikeal.rogers@gmail.com>
-.. sectionauthor:: Mikeal Rogers <mikeal.rogers@gmail.com>
-
-Command Line Usage
-------------------
-
-The mozmill command line is versatile and includes a fair amount of debugging options. Even though all these options are available mozmill should run by default without any arguments and find your locally installed Firefox and run with mozmill.
-
-In most modes, ctrl-c will shut down Firefox and exit out of the mozmill Python side as well.
-
-.. code-block:: none
-
- $ mozmill
-
-.. cmdoption:: -h, --help
-
- Show help message.
-
-.. cmdoption:: -b <binary>, --binary <binary>
-
- Specify application binary location.
-
- Default :class:`mozrunner.Profile` and :class:`mozrunner.Runner` are still
- :class:`mozrunner.FirefoxProfile` and :class:`mozrunner.FirefoxRunner`. You can
- change this by creating your own command line utility by subclassing :class:`CLI`
-
-.. cmdoption:: -d <defaultprofile>
-
- Specify the path to the default **clean** profile used to create new profiles.
-
-.. cmdoption:: -n, --no-new-profile
-
- Do not create a new fresh profile.
-
-.. cmdoption:: -p <profile>, --profile <profile>
-
- Specifies a profile to use. Must be used with --no-new-profile.
-
-.. cmdoption:: -w <plugins>, --plugins <plugins>
-
- Comma seperated list of additional paths to plugins to install.
-
- Plugins can be either .xpi zip compressed extensions or deflated extension directories.
-
-.. cmdoption:: -l <logfile>, --logfile <logfile>
-
- Log all events to *logfile*.
-
-.. cmdoption:: --report <uri>
-
- *Currently in development.*
-
- POST results to given brasstacks results server at *uri*.
-
-.. cmdoption:: -t <test>, --test <test>
-
- Run *test*. Can be either single test file or directory of tests.
-
-.. cmdoption:: --showall
-
- Show all test output.
-
-.. cmdoption:: -D, --debug
-
- Install debugging extensions and run with -jsconole
-
-.. cmdoption:: --show-errors
-
- Print all logger errors to the console. When running tests only test failures and skipped
- tests are printed, this option print all other errors.
-
-.. cmdoption:: -s, --shell
-
- Starts a Python shell for debugging.
-
-.. cmdoption:: -u, --usecode
-
- By default --shell mode will use iPython if install and fall back to using the code module.
- This option forces the use of the code module instead of iPython even when installed.
-
-.. cmdoption:: -P <port>, --port <port>
-
- Specify port for jsbridge.
-
-Command Line Class
-------------------
-
-.. class:: CLI
-
- Inherits from :class:`jsbridge.CLI` which inherits from :class:`mozrunner.CLI`.
-
- All the heavy lifting is handled by jsbridge and mozrunner. If you are subclassing
- this in order to creat a new command line interface be sure to call :func:`super` on all
- related methods.
-
- .. attribute:: runner_class
-
- Default runner class. Should be subclass of :class:`mozrunner.Runner`.
- Defaults to :class:`mozrunner.FirefoxRunner`.
-
- .. attribute:: profile_class
-
- Default profile class. Should be subclass of :class:`mozruner.Profile`.
- Defaults to :class:`mozrunner.FirefoxProfile`.
-
-Running MozMill from Python
----------------------------
-
-.. class:: MozMill([runner_class[, profile_class[, jsbridge_port]]])
-
- Manages an instance of Firefox w/ jsbridge and provides facilities for running tests and
- keeping track of results with callback methods.
-
- Default *runner_class* is :class:`mozrunner.FirefoxRunner`. Value should be a subclass of
- :class:`mozrunner.Runner`.
-
- Default *profile_class* is :class:`mozrunner.FirefoxProfile`. Value should be a subclass of
- :class:`mozrunner.Profile`.
-
- Default *jsbridge_port* is `24242`.
-
- .. attribute:: runner_class
-
- Set during initialization to subclass of :class:`mozrunner.Runner`.
-
- .. attribute:: profile_class
-
- Set during initialization to subclass of :class:`mozrunner.Profile`.
-
- .. attribute:: jsbridge_port
-
- Set during initialization to :class:`numbers.Integral`.
-
- .. method:: start([profile[, runner]])
-
- Start mozrunner and jsbridge pre-requisites.
-
- *profile* should be an instance of a `mozrunner.Profile` subclass. If one is not passed
- an instance of `self.profile_class` is created. `self.profile` will be set to this
- value.
-
- *runner* should be an instance of a `mozrunner.Runner` subclass. If one is not passed an
- instance of :attr:`runner_class` will be created. :attr:`runner` will be set to this value.
-
- This method will also run `runner.start()` and :func:`mozrunner.wait_and_create_network`
- and sets :attr:`back_channel` and :attr:`bridge` to instances of
- :class:`jsbridge.BackChannel` and :class:`jsbridge.Bridge` respectively.
-
- .. attribute:: profile
-
- Set during :meth:`start` to subclass of :class:`mozrunner.Profile`.
-
- .. attribute:: runner
-
- Set during :meth:`start` to subclass of :class:`mozrunner.Runner`.
-
- .. attribute:: back_channel
-
- Set during :meth:`start` to subclass of :class:`jsbridge.BackChannel`.
-
- .. attribute:: bridge
-
- Set during :meth:`start` to subclass of :class:`jsbridge.Bridge`
-
- .. method:: run_tests(test[, report])
-
- Run *test* in live Firefox using :attr:`bridge`.
-
- Adds local listeners :meth:`endTest_listener` and :meth:`endRunner_listener` to
- `"endTest"` and `"endRunner"` events using :meth:`jsbridge.BackChannel.add_listener` of
- :attr:`back_channel`.
-
- When tests are done the results are posted to a results server at *report* if passed.
-
- .. method:: endTest_listener(test)
-
- When a test is finished the test object will be passed to this callback.
-
- .. method:: endRunner_listener(obj)
-
- When all the tests are done running this callback will be fired.
-
-
\ No newline at end of file
deleted file mode 100644
index 7fb82154a1748d507925865d3fbf7508d62483e5..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
--- a/mail/test/resources/mozmill/docs/_build/html/_static/default.css
+++ /dev/null
@@ -1,657 +0,0 @@
-/**
- * Sphinx Doc Design
- */
-
-body {
- font-family: sans-serif;
- font-size: 100%;
- background-color: #11303d;
- color: #000;
- margin: 0;
- padding: 0;
-}
-
-/* :::: LAYOUT :::: */
-
-div.document {
- background-color: #1c4e63;
-}
-
-div.documentwrapper {
- float: left;
- width: 100%;
-}
-
-div.bodywrapper {
- margin: 0 0 0 230px;
-}
-
-div.body {
- background-color: white;
- padding: 0 20px 30px 20px;
-}
-
-div.sphinxsidebarwrapper {
- padding: 10px 5px 0 10px;
-}
-
-div.sphinxsidebar {
- float: left;
- width: 230px;
- margin-left: -100%;
- font-size: 90%;
-}
-
-div.clearer {
- clear: both;
-}
-
-div.footer {
- color: #fff;
- width: 100%;
- padding: 9px 0 9px 0;
- text-align: center;
- font-size: 75%;
-}
-
-div.footer a {
- color: #fff;
- text-decoration: underline;
-}
-
-div.related {
- background-color: #133f52;
- color: #fff;
- width: 100%;
- line-height: 30px;
- font-size: 90%;
-}
-
-div.related h3 {
- display: none;
-}
-
-div.related ul {
- margin: 0;
- padding: 0 0 0 10px;
- list-style: none;
-}
-
-div.related li {
- display: inline;
-}
-
-div.related li.right {
- float: right;
- margin-right: 5px;
-}
-
-div.related a {
- color: white;
-}
-
-/* ::: TOC :::: */
-div.sphinxsidebar h3 {
- font-family: 'Trebuchet MS', sans-serif;
- color: white;
- font-size: 1.4em;
- font-weight: normal;
- margin: 0;
- padding: 0;
-}
-
-div.sphinxsidebar h3 a {
- color: white;
-}
-
-div.sphinxsidebar h4 {
- font-family: 'Trebuchet MS', sans-serif;
- color: white;
- font-size: 1.3em;
- font-weight: normal;
- margin: 5px 0 0 0;
- padding: 0;
-}
-
-div.sphinxsidebar p {
- color: white;
-}
-
-div.sphinxsidebar p.topless {
- margin: 5px 10px 10px 10px;
-}
-
-div.sphinxsidebar ul {
- margin: 10px;
- padding: 0;
- list-style: none;
- color: white;
-}
-
-div.sphinxsidebar ul ul,
-div.sphinxsidebar ul.want-points {
- margin-left: 20px;
- list-style: square;
-}
-
-div.sphinxsidebar ul ul {
- margin-top: 0;
- margin-bottom: 0;
-}
-
-div.sphinxsidebar a {
- color: #98dbcc;
-}
-
-div.sphinxsidebar form {
- margin-top: 10px;
-}
-
-div.sphinxsidebar input {
- border: 1px solid #98dbcc;
- font-family: sans-serif;
- font-size: 1em;
-}
-
-/* :::: MODULE CLOUD :::: */
-div.modulecloud {
- margin: -5px 10px 5px 10px;
- padding: 10px;
- line-height: 160%;
- border: 1px solid #cbe7e5;
- background-color: #f2fbfd;
-}
-
-div.modulecloud a {
- padding: 0 5px 0 5px;
-}
-
-/* :::: SEARCH :::: */
-ul.search {
- margin: 10px 0 0 20px;
- padding: 0;
-}
-
-ul.search li {
- padding: 5px 0 5px 20px;
- background-image: url(file.png);
- background-repeat: no-repeat;
- background-position: 0 7px;
-}
-
-ul.search li a {
- font-weight: bold;
-}
-
-ul.search li div.context {
- color: #888;
- margin: 2px 0 0 30px;
- text-align: left;
-}
-
-ul.keywordmatches li.goodmatch a {
- font-weight: bold;
-}
-
-/* :::: COMMON FORM STYLES :::: */
-
-div.actions {
- padding: 5px 10px 5px 10px;
- border-top: 1px solid #cbe7e5;
- border-bottom: 1px solid #cbe7e5;
- background-color: #e0f6f4;
-}
-
-form dl {
- color: #333;
-}
-
-form dt {
- clear: both;
- float: left;
- min-width: 110px;
- margin-right: 10px;
- padding-top: 2px;
-}
-
-input#homepage {
- display: none;
-}
-
-div.error {
- margin: 5px 20px 0 0;
- padding: 5px;
- border: 1px solid #d00;
- font-weight: bold;
-}
-
-/* :::: INDEX PAGE :::: */
-
-table.contentstable {
- width: 90%;
-}
-
-table.contentstable p.biglink {
- line-height: 150%;
-}
-
-a.biglink {
- font-size: 1.3em;
-}
-
-span.linkdescr {
- font-style: italic;
- padding-top: 5px;
- font-size: 90%;
-}
-
-/* :::: INDEX STYLES :::: */
-
-table.indextable td {
- text-align: left;
- vertical-align: top;
-}
-
-table.indextable dl, table.indextable dd {
- margin-top: 0;
- margin-bottom: 0;
-}
-
-table.indextable tr.pcap {
- height: 10px;
-}
-
-table.indextable tr.cap {
- margin-top: 10px;
- background-color: #f2f2f2;
-}
-
-img.toggler {
- margin-right: 3px;
- margin-top: 3px;
- cursor: pointer;
-}
-
-form.pfform {
- margin: 10px 0 20px 0;
-}
-
-/* :::: GLOBAL STYLES :::: */
-
-.docwarning {
- background-color: #ffe4e4;
- padding: 10px;
- margin: 0 -20px 0 -20px;
- border-bottom: 1px solid #f66;
-}
-
-p.subhead {
- font-weight: bold;
- margin-top: 20px;
-}
-
-a {
- color: #355f7c;
- text-decoration: none;
-}
-
-a:hover {
- text-decoration: underline;
-}
-
-div.body h1,
-div.body h2,
-div.body h3,
-div.body h4,
-div.body h5,
-div.body h6 {
- font-family: 'Trebuchet MS', sans-serif;
- background-color: #f2f2f2;
- font-weight: normal;
- color: #20435c;
- border-bottom: 1px solid #ccc;
- margin: 20px -20px 10px -20px;
- padding: 3px 0 3px 10px;
-}
-
-div.body h1 { margin-top: 0; font-size: 200%; }
-div.body h2 { font-size: 160%; }
-div.body h3 { font-size: 140%; }
-div.body h4 { font-size: 120%; }
-div.body h5 { font-size: 110%; }
-div.body h6 { font-size: 100%; }
-
-a.headerlink {
- color: #c60f0f;
- font-size: 0.8em;
- padding: 0 4px 0 4px;
- text-decoration: none;
- visibility: hidden;
-}
-
-h1:hover > a.headerlink,
-h2:hover > a.headerlink,
-h3:hover > a.headerlink,
-h4:hover > a.headerlink,
-h5:hover > a.headerlink,
-h6:hover > a.headerlink,
-dt:hover > a.headerlink {
- visibility: visible;
-}
-
-a.headerlink:hover {
- background-color: #c60f0f;
- color: white;
-}
-
-div.body p, div.body dd, div.body li {
- text-align: justify;
- line-height: 130%;
-}
-
-div.body p.caption {
- text-align: inherit;
-}
-
-div.body td {
- text-align: left;
-}
-
-ul.fakelist {
- list-style: none;
- margin: 10px 0 10px 20px;
- padding: 0;
-}
-
-.field-list ul {
- padding-left: 1em;
-}
-
-.first {
- margin-top: 0 !important;
-}
-
-/* "Footnotes" heading */
-p.rubric {
- margin-top: 30px;
- font-weight: bold;
-}
-
-/* Sidebars */
-
-div.sidebar {
- margin: 0 0 0.5em 1em;
- border: 1px solid #ddb;
- padding: 7px 7px 0 7px;
- background-color: #ffe;
- width: 40%;
- float: right;
-}
-
-p.sidebar-title {
- font-weight: bold;
-}
-
-/* "Topics" */
-
-div.topic {
- background-color: #eee;
- border: 1px solid #ccc;
- padding: 7px 7px 0 7px;
- margin: 10px 0 10px 0;
-}
-
-p.topic-title {
- font-size: 1.1em;
- font-weight: bold;
- margin-top: 10px;
-}
-
-/* Admonitions */
-
-div.admonition {
- margin-top: 10px;
- margin-bottom: 10px;
- padding: 7px;
-}
-
-div.admonition dt {
- font-weight: bold;
-}
-
-div.admonition dl {
- margin-bottom: 0;
-}
-
-div.admonition p.admonition-title + p {
- display: inline;
-}
-
-div.seealso {
- background-color: #ffc;
- border: 1px solid #ff6;
-}
-
-div.warning {
- background-color: #ffe4e4;
- border: 1px solid #f66;
-}
-
-div.note {
- background-color: #eee;
- border: 1px solid #ccc;
-}
-
-p.admonition-title {
- margin: 0px 10px 5px 0px;
- font-weight: bold;
- display: inline;
-}
-
-p.admonition-title:after {
- content: ":";
-}
-
-div.body p.centered {
- text-align: center;
- margin-top: 25px;
-}
-
-table.docutils {
- border: 0;
-}
-
-table.docutils td, table.docutils th {
- padding: 1px 8px 1px 0;
- border-top: 0;
- border-left: 0;
- border-right: 0;
- border-bottom: 1px solid #aaa;
-}
-
-table.field-list td, table.field-list th {
- border: 0 !important;
-}
-
-table.footnote td, table.footnote th {
- border: 0 !important;
-}
-
-.field-list ul {
- margin: 0;
- padding-left: 1em;
-}
-
-.field-list p {
- margin: 0;
-}
-
-dl {
- margin-bottom: 15px;
- clear: both;
-}
-
-dd p {
- margin-top: 0px;
-}
-
-dd ul, dd table {
- margin-bottom: 10px;
-}
-
-dd {
- margin-top: 3px;
- margin-bottom: 10px;
- margin-left: 30px;
-}
-
-.refcount {
- color: #060;
-}
-
-dt:target,
-.highlight {
- background-color: #fbe54e;
-}
-
-dl.glossary dt {
- font-weight: bold;
- font-size: 1.1em;
-}
-
-th {
- text-align: left;
- padding-right: 5px;
-}
-
-pre {
- padding: 5px;
- background-color: #efc;
- color: #333;
- border: 1px solid #ac9;
- border-left: none;
- border-right: none;
- overflow: auto;
-}
-
-td.linenos pre {
- padding: 5px 0px;
- border: 0;
- background-color: transparent;
- color: #aaa;
-}
-
-table.highlighttable {
- margin-left: 0.5em;
-}
-
-table.highlighttable td {
- padding: 0 0.5em 0 0.5em;
-}
-
-tt {
- background-color: #ecf0f3;
- padding: 0 1px 0 1px;
- font-size: 0.95em;
-}
-
-tt.descname {
- background-color: transparent;
- font-weight: bold;
- font-size: 1.2em;
-}
-
-tt.descclassname {
- background-color: transparent;
-}
-
-tt.xref, a tt {
- background-color: transparent;
- font-weight: bold;
-}
-
-.footnote:target { background-color: #ffa }
-
-h1 tt, h2 tt, h3 tt, h4 tt, h5 tt, h6 tt {
- background-color: transparent;
-}
-
-.optional {
- font-size: 1.3em;
-}
-
-.versionmodified {
- font-style: italic;
-}
-
-form.comment {
- margin: 0;
- padding: 10px 30px 10px 30px;
- background-color: #eee;
-}
-
-form.comment h3 {
- background-color: #326591;
- color: white;
- margin: -10px -30px 10px -30px;
- padding: 5px;
- font-size: 1.4em;
-}
-
-form.comment input,
-form.comment textarea {
- border: 1px solid #ccc;
- padding: 2px;
- font-family: sans-serif;
- font-size: 100%;
-}
-
-form.comment input[type="text"] {
- width: 240px;
-}
-
-form.comment textarea {
- width: 100%;
- height: 200px;
- margin-bottom: 10px;
-}
-
-.system-message {
- background-color: #fda;
- padding: 5px;
- border: 3px solid red;
-}
-
-img.math {
- vertical-align: middle;
-}
-
-div.math p {
- text-align: center;
-}
-
-span.eqno {
- float: right;
-}
-
-img.logo {
- border: 0;
-}
-
-/* :::: PRINT :::: */
-@media print {
- div.document,
- div.documentwrapper,
- div.bodywrapper {
- margin: 0;
- width : 100%;
- }
-
- div.sphinxsidebar,
- div.related,
- div.footer,
- div#comments div.new-comment-box,
- #top-link {
- display: none;
- }
-}
deleted file mode 100644
--- a/mail/test/resources/mozmill/docs/_build/html/_static/doctools.js
+++ /dev/null
@@ -1,232 +0,0 @@
-/// XXX: make it cross browser
-
-/**
- * make the code below compatible with browsers without
- * an installed firebug like debugger
- */
-if (!window.console || !console.firebug) {
- var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml",
- "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];
- window.console = {};
- for (var i = 0; i < names.length; ++i)
- window.console[names[i]] = function() {}
-}
-
-/**
- * small helper function to urldecode strings
- */
-jQuery.urldecode = function(x) {
- return decodeURIComponent(x).replace(/\+/g, ' ');
-}
-
-/**
- * small helper function to urlencode strings
- */
-jQuery.urlencode = encodeURIComponent;
-
-/**
- * This function returns the parsed url parameters of the
- * current request. Multiple values per key are supported,
- * it will always return arrays of strings for the value parts.
- */
-jQuery.getQueryParameters = function(s) {
- if (typeof s == 'undefined')
- s = document.location.search;
- var parts = s.substr(s.indexOf('?') + 1).split('&');
- var result = {};
- for (var i = 0; i < parts.length; i++) {
- var tmp = parts[i].split('=', 2);
- var key = jQuery.urldecode(tmp[0]);
- var value = jQuery.urldecode(tmp[1]);
- if (key in result)
- result[key].push(value);
- else
- result[key] = [value];
- }
- return result;
-}
-
-/**
- * small function to check if an array contains
- * a given item.
- */
-jQuery.contains = function(arr, item) {
- for (var i = 0; i < arr.length; i++) {
- if (arr[i] == item)
- return true;
- }
- return false;
-}
-
-/**
- * highlight a given string on a jquery object by wrapping it in
- * span elements with the given class name.
- */
-jQuery.fn.highlightText = function(text, className) {
- function highlight(node) {
- if (node.nodeType == 3) {
- var val = node.nodeValue;
- var pos = val.toLowerCase().indexOf(text);
- if (pos >= 0 && !jQuery.className.has(node.parentNode, className)) {
- var span = document.createElement("span");
- span.className = className;
- span.appendChild(document.createTextNode(val.substr(pos, text.length)));
- node.parentNode.insertBefore(span, node.parentNode.insertBefore(
- document.createTextNode(val.substr(pos + text.length)),
- node.nextSibling));
- node.nodeValue = val.substr(0, pos);
- }
- }
- else if (!jQuery(node).is("button, select, textarea")) {
- jQuery.each(node.childNodes, function() {
- highlight(this)
- });
- }
- }
- return this.each(function() {
- highlight(this);
- });
-}
-
-/**
- * Small JavaScript module for the documentation.
- */
-var Documentation = {
-
- init : function() {
- this.fixFirefoxAnchorBug();
- this.highlightSearchWords();
- this.initModIndex();
- },
-
- /**
- * i18n support
- */
- TRANSLATIONS : {},
- PLURAL_EXPR : function(n) { return n == 1 ? 0 : 1; },
- LOCALE : 'unknown',
-
- // gettext and ngettext don't access this so that the functions
- // can savely bound to a different name (_ = Documentation.gettext)
- gettext : function(string) {
- var translated = Documentation.TRANSLATIONS[string];
- if (typeof translated == 'undefined')
- return string;
- return (typeof translated == 'string') ? translated : translated[0];
- },
-
- ngettext : function(singular, plural, n) {
- var translated = Documentation.TRANSLATIONS[singular];
- if (typeof translated == 'undefined')
- return (n == 1) ? singular : plural;
- return translated[Documentation.PLURALEXPR(n)];
- },
-
- addTranslations : function(catalog) {
- for (var key in catalog.messages)
- this.TRANSLATIONS[key] = catalog.messages[key];
- this.PLURAL_EXPR = new Function('n', 'return +(' + catalog.plural_expr + ')');
- this.LOCALE = catalog.locale;
- },
-
- /**
- * add context elements like header anchor links
- */
- addContextElements : function() {
- $('div[@id] > :header:first').each(function() {
- $('<a class="headerlink">\u00B6</a>').
- attr('href', '#' + this.id).
- attr('title', _('Permalink to this headline')).
- appendTo(this);
- });
- $('dt[@id]').each(function() {
- $('<a class="headerlink">\u00B6</a>').
- attr('href', '#' + this.id).
- attr('title', _('Permalink to this definition')).
- appendTo(this);
- });
- },
-
- /**
- * workaround a firefox stupidity
- */
- fixFirefoxAnchorBug : function() {
- if (document.location.hash && $.browser.mozilla)
- window.setTimeout(function() {
- document.location.href += '';
- }, 10);
- },
-
- /**
- * highlight the search words provided in the url in the text
- */
- highlightSearchWords : function() {
- var params = $.getQueryParameters();
- var terms = (params.highlight) ? params.highlight[0].split(/\s+/) : [];
- if (terms.length) {
- var body = $('div.body');
- window.setTimeout(function() {
- $.each(terms, function() {
- body.highlightText(this.toLowerCase(), 'highlight');
- });
- }, 10);
- $('<li class="highlight-link"><a href="javascript:Documentation.' +
- 'hideSearchWords()">' + _('Hide Search Matches') + '</a></li>')
- .appendTo($('.sidebar .this-page-menu'));
- }
- },
-
- /**
- * init the modindex toggle buttons
- */
- initModIndex : function() {
- var togglers = $('img.toggler').click(function() {
- var src = $(this).attr('src');
- var idnum = $(this).attr('id').substr(7);
- console.log($('tr.cg-' + idnum).toggle());
- if (src.substr(-9) == 'minus.png')
- $(this).attr('src', src.substr(0, src.length-9) + 'plus.png');
- else
- $(this).attr('src', src.substr(0, src.length-8) + 'minus.png');
- }).css('display', '');
- if (DOCUMENTATION_OPTIONS.COLLAPSE_MODINDEX) {
- togglers.click();
- }
- },
-
- /**
- * helper function to hide the search marks again
- */
- hideSearchWords : function() {
- $('.sidebar .this-page-menu li.highlight-link').fadeOut(300);
- $('span.highlight').removeClass('highlight');
- },
-
- /**
- * make the url absolute
- */
- makeURL : function(relativeURL) {
- return DOCUMENTATION_OPTIONS.URL_ROOT + '/' + relativeURL;
- },
-
- /**
- * get the current relative url
- */
- getCurrentURL : function() {
- var path = document.location.pathname;
- var parts = path.split(/\//);
- $.each(DOCUMENTATION_OPTIONS.URL_ROOT.split(/\//), function() {
- if (this == '..')
- parts.pop();
- });
- var url = parts.join('/');
- return path.substring(url.lastIndexOf('/') + 1, path.length - 1);
- }
-};
-
-// quick alias for translations
-_ = Documentation.gettext;
-
-$(document).ready(function() {
- Documentation.init();
-});
deleted file mode 100644
index d18082e397e7e54f20721af768c4c2983258f1b4..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
--- a/mail/test/resources/mozmill/docs/_build/html/_static/jquery.js
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * jQuery 1.2.6 - New Wave Javascript
- *
- * Copyright (c) 2008 John Resig (jquery.com)
- * Dual licensed under the MIT (MIT-LICENSE.txt)
- * and GPL (GPL-LICENSE.txt) licenses.
- *
- * $Date: 2008-05-24 14:22:17 -0400 (Sat, 24 May 2008) $
- * $Rev: 5685 $
- */
-(function(){var _jQuery=window.jQuery,_$=window.$;var jQuery=window.jQuery=window.$=function(selector,context){return new jQuery.fn.init(selector,context);};var quickExpr=/^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/,isSimple=/^.[^:#\[\.]*$/,undefined;jQuery.fn=jQuery.prototype={init:function(selector,context){selector=selector||document;if(selector.nodeType){this[0]=selector;this.length=1;return this;}if(typeof selector=="string"){var match=quickExpr.exec(selector);if(match&&(match[1]||!context)){if(match[1])selector=jQuery.clean([match[1]],context);else{var elem=document.getElementById(match[3]);if(elem){if(elem.id!=match[3])return jQuery().find(selector);return jQuery(elem);}selector=[];}}else
-return jQuery(context).find(selector);}else if(jQuery.isFunction(selector))return jQuery(document)[jQuery.fn.ready?"ready":"load"](selector);return this.setArray(jQuery.makeArray(selector));},jquery:"1.2.6",size:function(){return this.length;},length:0,get:function(num){return num==undefined?jQuery.makeArray(this):this[num];},pushStack:function(elems){var ret=jQuery(elems);ret.prevObject=this;return ret;},setArray:function(elems){this.length=0;Array.prototype.push.apply(this,elems);return this;},each:function(callback,args){return jQuery.each(this,callback,args);},index:function(elem){var ret=-1;return jQuery.inArray(elem&&elem.jquery?elem[0]:elem,this);},attr:function(name,value,type){var options=name;if(name.constructor==String)if(value===undefined)return this[0]&&jQuery[type||"attr"](this[0],name);else{options={};options[name]=value;}return this.each(function(i){for(name in options)jQuery.attr(type?this.style:this,name,jQuery.prop(this,options[name],type,i,name));});},css:function(key,value){if((key=='width'||key=='height')&&parseFloat(value)<0)value=undefined;return this.attr(key,value,"curCSS");},text:function(text){if(typeof text!="object"&&text!=null)return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(text));var ret="";jQuery.each(text||this,function(){jQuery.each(this.childNodes,function(){if(this.nodeType!=8)ret+=this.nodeType!=1?this.nodeValue:jQuery.fn.text([this]);});});return ret;},wrapAll:function(html){if(this[0])jQuery(html,this[0].ownerDocument).clone().insertBefore(this[0]).map(function(){var elem=this;while(elem.firstChild)elem=elem.firstChild;return elem;}).append(this);return this;},wrapInner:function(html){return this.each(function(){jQuery(this).contents().wrapAll(html);});},wrap:function(html){return this.each(function(){jQuery(this).wrapAll(html);});},append:function(){return this.domManip(arguments,true,false,function(elem){if(this.nodeType==1)this.appendChild(elem);});},prepend:function(){return this.domManip(arguments,true,true,function(elem){if(this.nodeType==1)this.insertBefore(elem,this.firstChild);});},before:function(){return this.domManip(arguments,false,false,function(elem){this.parentNode.insertBefore(elem,this);});},after:function(){return this.domManip(arguments,false,true,function(elem){this.parentNode.insertBefore(elem,this.nextSibling);});},end:function(){return this.prevObject||jQuery([]);},find:function(selector){var elems=jQuery.map(this,function(elem){return jQuery.find(selector,elem);});return this.pushStack(/[^+>] [^+>]/.test(selector)||selector.indexOf("..")>-1?jQuery.unique(elems):elems);},clone:function(events){var ret=this.map(function(){if(jQuery.browser.msie&&!jQuery.isXMLDoc(this)){var clone=this.cloneNode(true),container=document.createElement("div");container.appendChild(clone);return jQuery.clean([container.innerHTML])[0];}else
-return this.cloneNode(true);});var clone=ret.find("*").andSelf().each(function(){if(this[expando]!=undefined)this[expando]=null;});if(events===true)this.find("*").andSelf().each(function(i){if(this.nodeType==3)return;var events=jQuery.data(this,"events");for(var type in events)for(var handler in events[type])jQuery.event.add(clone[i],type,events[type][handler],events[type][handler].data);});return ret;},filter:function(selector){return this.pushStack(jQuery.isFunction(selector)&&jQuery.grep(this,function(elem,i){return selector.call(elem,i);})||jQuery.multiFilter(selector,this));},not:function(selector){if(selector.constructor==String)if(isSimple.test(selector))return this.pushStack(jQuery.multiFilter(selector,this,true));else
-selector=jQuery.multiFilter(selector,this);var isArrayLike=selector.length&&selector[selector.length-1]!==undefined&&!selector.nodeType;return this.filter(function(){return isArrayLike?jQuery.inArray(this,selector)<0:this!=selector;});},add:function(selector){return this.pushStack(jQuery.unique(jQuery.merge(this.get(),typeof selector=='string'?jQuery(selector):jQuery.makeArray(selector))));},is:function(selector){return!!selector&&jQuery.multiFilter(selector,this).length>0;},hasClass:function(selector){return this.is("."+selector);},val:function(value){if(value==undefined){if(this.length){var elem=this[0];if(jQuery.nodeName(elem,"select")){var index=elem.selectedIndex,values=[],options=elem.options,one=elem.type=="select-one";if(index<0)return null;for(var i=one?index:0,max=one?index+1:options.length;i<max;i++){var option=options[i];if(option.selected){value=jQuery.browser.msie&&!option.attributes.value.specified?option.text:option.value;if(one)return value;values.push(value);}}return values;}else
-return(this[0].value||"").replace(/\r/g,"");}return undefined;}if(value.constructor==Number)value+='';return this.each(function(){if(this.nodeType!=1)return;if(value.constructor==Array&&/radio|checkbox/.test(this.type))this.checked=(jQuery.inArray(this.value,value)>=0||jQuery.inArray(this.name,value)>=0);else if(jQuery.nodeName(this,"select")){var values=jQuery.makeArray(value);jQuery("option",this).each(function(){this.selected=(jQuery.inArray(this.value,values)>=0||jQuery.inArray(this.text,values)>=0);});if(!values.length)this.selectedIndex=-1;}else
-this.value=value;});},html:function(value){return value==undefined?(this[0]?this[0].innerHTML:null):this.empty().append(value);},replaceWith:function(value){return this.after(value).remove();},eq:function(i){return this.slice(i,i+1);},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments));},map:function(callback){return this.pushStack(jQuery.map(this,function(elem,i){return callback.call(elem,i,elem);}));},andSelf:function(){return this.add(this.prevObject);},data:function(key,value){var parts=key.split(".");parts[1]=parts[1]?"."+parts[1]:"";if(value===undefined){var data=this.triggerHandler("getData"+parts[1]+"!",[parts[0]]);if(data===undefined&&this.length)data=jQuery.data(this[0],key);return data===undefined&&parts[1]?this.data(parts[0]):data;}else
-return this.trigger("setData"+parts[1]+"!",[parts[0],value]).each(function(){jQuery.data(this,key,value);});},removeData:function(key){return this.each(function(){jQuery.removeData(this,key);});},domManip:function(args,table,reverse,callback){var clone=this.length>1,elems;return this.each(function(){if(!elems){elems=jQuery.clean(args,this.ownerDocument);if(reverse)elems.reverse();}var obj=this;if(table&&jQuery.nodeName(this,"table")&&jQuery.nodeName(elems[0],"tr"))obj=this.getElementsByTagName("tbody")[0]||this.appendChild(this.ownerDocument.createElement("tbody"));var scripts=jQuery([]);jQuery.each(elems,function(){var elem=clone?jQuery(this).clone(true)[0]:this;if(jQuery.nodeName(elem,"script"))scripts=scripts.add(elem);else{if(elem.nodeType==1)scripts=scripts.add(jQuery("script",elem).remove());callback.call(obj,elem);}});scripts.each(evalScript);});}};jQuery.fn.init.prototype=jQuery.fn;function evalScript(i,elem){if(elem.src)jQuery.ajax({url:elem.src,async:false,dataType:"script"});else
-jQuery.globalEval(elem.text||elem.textContent||elem.innerHTML||"");if(elem.parentNode)elem.parentNode.removeChild(elem);}function now(){return+new Date;}jQuery.extend=jQuery.fn.extend=function(){var target=arguments[0]||{},i=1,length=arguments.length,deep=false,options;if(target.constructor==Boolean){deep=target;target=arguments[1]||{};i=2;}if(typeof target!="object"&&typeof target!="function")target={};if(length==i){target=this;--i;}for(;i<length;i++)if((options=arguments[i])!=null)for(var name in options){var src=target[name],copy=options[name];if(target===copy)continue;if(deep&©&&typeof copy=="object"&&!copy.nodeType)target[name]=jQuery.extend(deep,src||(copy.length!=null?[]:{}),copy);else if(copy!==undefined)target[name]=copy;}return target;};var expando="jQuery"+now(),uuid=0,windowData={},exclude=/z-?index|font-?weight|opacity|zoom|line-?height/i,defaultView=document.defaultView||{};jQuery.extend({noConflict:function(deep){window.$=_$;if(deep)window.jQuery=_jQuery;return jQuery;},isFunction:function(fn){return!!fn&&typeof fn!="string"&&!fn.nodeName&&fn.constructor!=Array&&/^[\s[]?function/.test(fn+"");},isXMLDoc:function(elem){return elem.documentElement&&!elem.body||elem.tagName&&elem.ownerDocument&&!elem.ownerDocument.body;},globalEval:function(data){data=jQuery.trim(data);if(data){var head=document.getElementsByTagName("head")[0]||document.documentElement,script=document.createElement("script");script.type="text/javascript";if(jQuery.browser.msie)script.text=data;else
-script.appendChild(document.createTextNode(data));head.insertBefore(script,head.firstChild);head.removeChild(script);}},nodeName:function(elem,name){return elem.nodeName&&elem.nodeName.toUpperCase()==name.toUpperCase();},cache:{},data:function(elem,name,data){elem=elem==window?windowData:elem;var id=elem[expando];if(!id)id=elem[expando]=++uuid;if(name&&!jQuery.cache[id])jQuery.cache[id]={};if(data!==undefined)jQuery.cache[id][name]=data;return name?jQuery.cache[id][name]:id;},removeData:function(elem,name){elem=elem==window?windowData:elem;var id=elem[expando];if(name){if(jQuery.cache[id]){delete jQuery.cache[id][name];name="";for(name in jQuery.cache[id])break;if(!name)jQuery.removeData(elem);}}else{try{delete elem[expando];}catch(e){if(elem.removeAttribute)elem.removeAttribute(expando);}delete jQuery.cache[id];}},each:function(object,callback,args){var name,i=0,length=object.length;if(args){if(length==undefined){for(name in object)if(callback.apply(object[name],args)===false)break;}else
-for(;i<length;)if(callback.apply(object[i++],args)===false)break;}else{if(length==undefined){for(name in object)if(callback.call(object[name],name,object[name])===false)break;}else
-for(var value=object[0];i<length&&callback.call(value,i,value)!==false;value=object[++i]){}}return object;},prop:function(elem,value,type,i,name){if(jQuery.isFunction(value))value=value.call(elem,i);return value&&value.constructor==Number&&type=="curCSS"&&!exclude.test(name)?value+"px":value;},className:{add:function(elem,classNames){jQuery.each((classNames||"").split(/\s+/),function(i,className){if(elem.nodeType==1&&!jQuery.className.has(elem.className,className))elem.className+=(elem.className?" ":"")+className;});},remove:function(elem,classNames){if(elem.nodeType==1)elem.className=classNames!=undefined?jQuery.grep(elem.className.split(/\s+/),function(className){return!jQuery.className.has(classNames,className);}).join(" "):"";},has:function(elem,className){return jQuery.inArray(className,(elem.className||elem).toString().split(/\s+/))>-1;}},swap:function(elem,options,callback){var old={};for(var name in options){old[name]=elem.style[name];elem.style[name]=options[name];}callback.call(elem);for(var name in options)elem.style[name]=old[name];},css:function(elem,name,force){if(name=="width"||name=="height"){var val,props={position:"absolute",visibility:"hidden",display:"block"},which=name=="width"?["Left","Right"]:["Top","Bottom"];function getWH(){val=name=="width"?elem.offsetWidth:elem.offsetHeight;var padding=0,border=0;jQuery.each(which,function(){padding+=parseFloat(jQuery.curCSS(elem,"padding"+this,true))||0;border+=parseFloat(jQuery.curCSS(elem,"border"+this+"Width",true))||0;});val-=Math.round(padding+border);}if(jQuery(elem).is(":visible"))getWH();else
-jQuery.swap(elem,props,getWH);return Math.max(0,val);}return jQuery.curCSS(elem,name,force);},curCSS:function(elem,name,force){var ret,style=elem.style;function color(elem){if(!jQuery.browser.safari)return false;var ret=defaultView.getComputedStyle(elem,null);return!ret||ret.getPropertyValue("color")=="";}if(name=="opacity"&&jQuery.browser.msie){ret=jQuery.attr(style,"opacity");return ret==""?"1":ret;}if(jQuery.browser.opera&&name=="display"){var save=style.outline;style.outline="0 solid black";style.outline=save;}if(name.match(/float/i))name=styleFloat;if(!force&&style&&style[name])ret=style[name];else if(defaultView.getComputedStyle){if(name.match(/float/i))name="float";name=name.replace(/([A-Z])/g,"-$1").toLowerCase();var computedStyle=defaultView.getComputedStyle(elem,null);if(computedStyle&&!color(elem))ret=computedStyle.getPropertyValue(name);else{var swap=[],stack=[],a=elem,i=0;for(;a&&color(a);a=a.parentNode)stack.unshift(a);for(;i<stack.length;i++)if(color(stack[i])){swap[i]=stack[i].style.display;stack[i].style.display="block";}ret=name=="display"&&swap[stack.length-1]!=null?"none":(computedStyle&&computedStyle.getPropertyValue(name))||"";for(i=0;i<swap.length;i++)if(swap[i]!=null)stack[i].style.display=swap[i];}if(name=="opacity"&&ret=="")ret="1";}else if(elem.currentStyle){var camelCase=name.replace(/\-(\w)/g,function(all,letter){return letter.toUpperCase();});ret=elem.currentStyle[name]||elem.currentStyle[camelCase];if(!/^\d+(px)?$/i.test(ret)&&/^\d/.test(ret)){var left=style.left,rsLeft=elem.runtimeStyle.left;elem.runtimeStyle.left=elem.currentStyle.left;style.left=ret||0;ret=style.pixelLeft+"px";style.left=left;elem.runtimeStyle.left=rsLeft;}}return ret;},clean:function(elems,context){var ret=[];context=context||document;if(typeof context.createElement=='undefined')context=context.ownerDocument||context[0]&&context[0].ownerDocument||document;jQuery.each(elems,function(i,elem){if(!elem)return;if(elem.constructor==Number)elem+='';if(typeof elem=="string"){elem=elem.replace(/(<(\w+)[^>]*?)\/>/g,function(all,front,tag){return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?all:front+"></"+tag+">";});var tags=jQuery.trim(elem).toLowerCase(),div=context.createElement("div");var wrap=!tags.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!tags.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||tags.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!tags.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!tags.indexOf("<td")||!tags.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!tags.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||jQuery.browser.msie&&[1,"div<div>","</div>"]||[0,"",""];div.innerHTML=wrap[1]+elem+wrap[2];while(wrap[0]--)div=div.lastChild;if(jQuery.browser.msie){var tbody=!tags.indexOf("<table")&&tags.indexOf("<tbody")<0?div.firstChild&&div.firstChild.childNodes:wrap[1]=="<table>"&&tags.indexOf("<tbody")<0?div.childNodes:[];for(var j=tbody.length-1;j>=0;--j)if(jQuery.nodeName(tbody[j],"tbody")&&!tbody[j].childNodes.length)tbody[j].parentNode.removeChild(tbody[j]);if(/^\s/.test(elem))div.insertBefore(context.createTextNode(elem.match(/^\s*/)[0]),div.firstChild);}elem=jQuery.makeArray(div.childNodes);}if(elem.length===0&&(!jQuery.nodeName(elem,"form")&&!jQuery.nodeName(elem,"select")))return;if(elem[0]==undefined||jQuery.nodeName(elem,"form")||elem.options)ret.push(elem);else
-ret=jQuery.merge(ret,elem);});return ret;},attr:function(elem,name,value){if(!elem||elem.nodeType==3||elem.nodeType==8)return undefined;var notxml=!jQuery.isXMLDoc(elem),set=value!==undefined,msie=jQuery.browser.msie;name=notxml&&jQuery.props[name]||name;if(elem.tagName){var special=/href|src|style/.test(name);if(name=="selected"&&jQuery.browser.safari)elem.parentNode.selectedIndex;if(name in elem&¬xml&&!special){if(set){if(name=="type"&&jQuery.nodeName(elem,"input")&&elem.parentNode)throw"type property can't be changed";elem[name]=value;}if(jQuery.nodeName(elem,"form")&&elem.getAttributeNode(name))return elem.getAttributeNode(name).nodeValue;return elem[name];}if(msie&¬xml&&name=="style")return jQuery.attr(elem.style,"cssText",value);if(set)elem.setAttribute(name,""+value);var attr=msie&¬xml&&special?elem.getAttribute(name,2):elem.getAttribute(name);return attr===null?undefined:attr;}if(msie&&name=="opacity"){if(set){elem.zoom=1;elem.filter=(elem.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(value)+''=="NaN"?"":"alpha(opacity="+value*100+")");}return elem.filter&&elem.filter.indexOf("opacity=")>=0?(parseFloat(elem.filter.match(/opacity=([^)]*)/)[1])/100)+'':"";}name=name.replace(/-([a-z])/ig,function(all,letter){return letter.toUpperCase();});if(set)elem[name]=value;return elem[name];},trim:function(text){return(text||"").replace(/^\s+|\s+$/g,"");},makeArray:function(array){var ret=[];if(array!=null){var i=array.length;if(i==null||array.split||array.setInterval||array.call)ret[0]=array;else
-while(i)ret[--i]=array[i];}return ret;},inArray:function(elem,array){for(var i=0,length=array.length;i<length;i++)if(array[i]===elem)return i;return-1;},merge:function(first,second){var i=0,elem,pos=first.length;if(jQuery.browser.msie){while(elem=second[i++])if(elem.nodeType!=8)first[pos++]=elem;}else
-while(elem=second[i++])first[pos++]=elem;return first;},unique:function(array){var ret=[],done={};try{for(var i=0,length=array.length;i<length;i++){var id=jQuery.data(array[i]);if(!done[id]){done[id]=true;ret.push(array[i]);}}}catch(e){ret=array;}return ret;},grep:function(elems,callback,inv){var ret=[];for(var i=0,length=elems.length;i<length;i++)if(!inv!=!callback(elems[i],i))ret.push(elems[i]);return ret;},map:function(elems,callback){var ret=[];for(var i=0,length=elems.length;i<length;i++){var value=callback(elems[i],i);if(value!=null)ret[ret.length]=value;}return ret.concat.apply([],ret);}});var userAgent=navigator.userAgent.toLowerCase();jQuery.browser={version:(userAgent.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[])[1],safari:/webkit/.test(userAgent),opera:/opera/.test(userAgent),msie:/msie/.test(userAgent)&&!/opera/.test(userAgent),mozilla:/mozilla/.test(userAgent)&&!/(compatible|webkit)/.test(userAgent)};var styleFloat=jQuery.browser.msie?"styleFloat":"cssFloat";jQuery.extend({boxModel:!jQuery.browser.msie||document.compatMode=="CSS1Compat",props:{"for":"htmlFor","class":"className","float":styleFloat,cssFloat:styleFloat,styleFloat:styleFloat,readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing"}});jQuery.each({parent:function(elem){return elem.parentNode;},parents:function(elem){return jQuery.dir(elem,"parentNode");},next:function(elem){return jQuery.nth(elem,2,"nextSibling");},prev:function(elem){return jQuery.nth(elem,2,"previousSibling");},nextAll:function(elem){return jQuery.dir(elem,"nextSibling");},prevAll:function(elem){return jQuery.dir(elem,"previousSibling");},siblings:function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem);},children:function(elem){return jQuery.sibling(elem.firstChild);},contents:function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes);}},function(name,fn){jQuery.fn[name]=function(selector){var ret=jQuery.map(this,fn);if(selector&&typeof selector=="string")ret=jQuery.multiFilter(selector,ret);return this.pushStack(jQuery.unique(ret));};});jQuery.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(name,original){jQuery.fn[name]=function(){var args=arguments;return this.each(function(){for(var i=0,length=args.length;i<length;i++)jQuery(args[i])[original](this);});};});jQuery.each({removeAttr:function(name){jQuery.attr(this,name,"");if(this.nodeType==1)this.removeAttribute(name);},addClass:function(classNames){jQuery.className.add(this,classNames);},removeClass:function(classNames){jQuery.className.remove(this,classNames);},toggleClass:function(classNames){jQuery.className[jQuery.className.has(this,classNames)?"remove":"add"](this,classNames);},remove:function(selector){if(!selector||jQuery.filter(selector,[this]).r.length){jQuery("*",this).add(this).each(function(){jQuery.event.remove(this);jQuery.removeData(this);});if(this.parentNode)this.parentNode.removeChild(this);}},empty:function(){jQuery(">*",this).remove();while(this.firstChild)this.removeChild(this.firstChild);}},function(name,fn){jQuery.fn[name]=function(){return this.each(fn,arguments);};});jQuery.each(["Height","Width"],function(i,name){var type=name.toLowerCase();jQuery.fn[type]=function(size){return this[0]==window?jQuery.browser.opera&&document.body["client"+name]||jQuery.browser.safari&&window["inner"+name]||document.compatMode=="CSS1Compat"&&document.documentElement["client"+name]||document.body["client"+name]:this[0]==document?Math.max(Math.max(document.body["scroll"+name],document.documentElement["scroll"+name]),Math.max(document.body["offset"+name],document.documentElement["offset"+name])):size==undefined?(this.length?jQuery.css(this[0],type):null):this.css(type,size.constructor==String?size:size+"px");};});function num(elem,prop){return elem[0]&&parseInt(jQuery.curCSS(elem[0],prop,true),10)||0;}var chars=jQuery.browser.safari&&parseInt(jQuery.browser.version)<417?"(?:[\\w*_-]|\\\\.)":"(?:[\\w\u0128-\uFFFF*_-]|\\\\.)",quickChild=new RegExp("^>\\s*("+chars+"+)"),quickID=new RegExp("^("+chars+"+)(#)("+chars+"+)"),quickClass=new RegExp("^([#.]?)("+chars+"*)");jQuery.extend({expr:{"":function(a,i,m){return m[2]=="*"||jQuery.nodeName(a,m[2]);},"#":function(a,i,m){return a.getAttribute("id")==m[2];},":":{lt:function(a,i,m){return i<m[3]-0;},gt:function(a,i,m){return i>m[3]-0;},nth:function(a,i,m){return m[3]-0==i;},eq:function(a,i,m){return m[3]-0==i;},first:function(a,i){return i==0;},last:function(a,i,m,r){return i==r.length-1;},even:function(a,i){return i%2==0;},odd:function(a,i){return i%2;},"first-child":function(a){return a.parentNode.getElementsByTagName("*")[0]==a;},"last-child":function(a){return jQuery.nth(a.parentNode.lastChild,1,"previousSibling")==a;},"only-child":function(a){return!jQuery.nth(a.parentNode.lastChild,2,"previousSibling");},parent:function(a){return a.firstChild;},empty:function(a){return!a.firstChild;},contains:function(a,i,m){return(a.textContent||a.innerText||jQuery(a).text()||"").indexOf(m[3])>=0;},visible:function(a){return"hidden"!=a.type&&jQuery.css(a,"display")!="none"&&jQuery.css(a,"visibility")!="hidden";},hidden:function(a){return"hidden"==a.type||jQuery.css(a,"display")=="none"||jQuery.css(a,"visibility")=="hidden";},enabled:function(a){return!a.disabled;},disabled:function(a){return a.disabled;},checked:function(a){return a.checked;},selected:function(a){return a.selected||jQuery.attr(a,"selected");},text:function(a){return"text"==a.type;},radio:function(a){return"radio"==a.type;},checkbox:function(a){return"checkbox"==a.type;},file:function(a){return"file"==a.type;},password:function(a){return"password"==a.type;},submit:function(a){return"submit"==a.type;},image:function(a){return"image"==a.type;},reset:function(a){return"reset"==a.type;},button:function(a){return"button"==a.type||jQuery.nodeName(a,"button");},input:function(a){return/input|select|textarea|button/i.test(a.nodeName);},has:function(a,i,m){return jQuery.find(m[3],a).length;},header:function(a){return/h\d/i.test(a.nodeName);},animated:function(a){return jQuery.grep(jQuery.timers,function(fn){return a==fn.elem;}).length;}}},parse:[/^(\[) *@?([\w-]+) *([!*$^~=]*) *('?"?)(.*?)\4 *\]/,/^(:)([\w-]+)\("?'?(.*?(\(.*?\))?[^(]*?)"?'?\)/,new RegExp("^([:.#]*)("+chars+"+)")],multiFilter:function(expr,elems,not){var old,cur=[];while(expr&&expr!=old){old=expr;var f=jQuery.filter(expr,elems,not);expr=f.t.replace(/^\s*,\s*/,"");cur=not?elems=f.r:jQuery.merge(cur,f.r);}return cur;},find:function(t,context){if(typeof t!="string")return[t];if(context&&context.nodeType!=1&&context.nodeType!=9)return[];context=context||document;var ret=[context],done=[],last,nodeName;while(t&&last!=t){var r=[];last=t;t=jQuery.trim(t);var foundToken=false,re=quickChild,m=re.exec(t);if(m){nodeName=m[1].toUpperCase();for(var i=0;ret[i];i++)for(var c=ret[i].firstChild;c;c=c.nextSibling)if(c.nodeType==1&&(nodeName=="*"||c.nodeName.toUpperCase()==nodeName))r.push(c);ret=r;t=t.replace(re,"");if(t.indexOf(" ")==0)continue;foundToken=true;}else{re=/^([>+~])\s*(\w*)/i;if((m=re.exec(t))!=null){r=[];var merge={};nodeName=m[2].toUpperCase();m=m[1];for(var j=0,rl=ret.length;j<rl;j++){var n=m=="~"||m=="+"?ret[j].nextSibling:ret[j].firstChild;for(;n;n=n.nextSibling)if(n.nodeType==1){var id=jQuery.data(n);if(m=="~"&&merge[id])break;if(!nodeName||n.nodeName.toUpperCase()==nodeName){if(m=="~")merge[id]=true;r.push(n);}if(m=="+")break;}}ret=r;t=jQuery.trim(t.replace(re,""));foundToken=true;}}if(t&&!foundToken){if(!t.indexOf(",")){if(context==ret[0])ret.shift();done=jQuery.merge(done,ret);r=ret=[context];t=" "+t.substr(1,t.length);}else{var re2=quickID;var m=re2.exec(t);if(m){m=[0,m[2],m[3],m[1]];}else{re2=quickClass;m=re2.exec(t);}m[2]=m[2].replace(/\\/g,"");var elem=ret[ret.length-1];if(m[1]=="#"&&elem&&elem.getElementById&&!jQuery.isXMLDoc(elem)){var oid=elem.getElementById(m[2]);if((jQuery.browser.msie||jQuery.browser.opera)&&oid&&typeof oid.id=="string"&&oid.id!=m[2])oid=jQuery('[@id="'+m[2]+'"]',elem)[0];ret=r=oid&&(!m[3]||jQuery.nodeName(oid,m[3]))?[oid]:[];}else{for(var i=0;ret[i];i++){var tag=m[1]=="#"&&m[3]?m[3]:m[1]!=""||m[0]==""?"*":m[2];if(tag=="*"&&ret[i].nodeName.toLowerCase()=="object")tag="param";r=jQuery.merge(r,ret[i].getElementsByTagName(tag));}if(m[1]==".")r=jQuery.classFilter(r,m[2]);if(m[1]=="#"){var tmp=[];for(var i=0;r[i];i++)if(r[i].getAttribute("id")==m[2]){tmp=[r[i]];break;}r=tmp;}ret=r;}t=t.replace(re2,"");}}if(t){var val=jQuery.filter(t,r);ret=r=val.r;t=jQuery.trim(val.t);}}if(t)ret=[];if(ret&&context==ret[0])ret.shift();done=jQuery.merge(done,ret);return done;},classFilter:function(r,m,not){m=" "+m+" ";var tmp=[];for(var i=0;r[i];i++){var pass=(" "+r[i].className+" ").indexOf(m)>=0;if(!not&&pass||not&&!pass)tmp.push(r[i]);}return tmp;},filter:function(t,r,not){var last;while(t&&t!=last){last=t;var p=jQuery.parse,m;for(var i=0;p[i];i++){m=p[i].exec(t);if(m){t=t.substring(m[0].length);m[2]=m[2].replace(/\\/g,"");break;}}if(!m)break;if(m[1]==":"&&m[2]=="not")r=isSimple.test(m[3])?jQuery.filter(m[3],r,true).r:jQuery(r).not(m[3]);else if(m[1]==".")r=jQuery.classFilter(r,m[2],not);else if(m[1]=="["){var tmp=[],type=m[3];for(var i=0,rl=r.length;i<rl;i++){var a=r[i],z=a[jQuery.props[m[2]]||m[2]];if(z==null||/href|src|selected/.test(m[2]))z=jQuery.attr(a,m[2])||'';if((type==""&&!!z||type=="="&&z==m[5]||type=="!="&&z!=m[5]||type=="^="&&z&&!z.indexOf(m[5])||type=="$="&&z.substr(z.length-m[5].length)==m[5]||(type=="*="||type=="~=")&&z.indexOf(m[5])>=0)^not)tmp.push(a);}r=tmp;}else if(m[1]==":"&&m[2]=="nth-child"){var merge={},tmp=[],test=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(m[3]=="even"&&"2n"||m[3]=="odd"&&"2n+1"||!/\D/.test(m[3])&&"0n+"+m[3]||m[3]),first=(test[1]+(test[2]||1))-0,last=test[3]-0;for(var i=0,rl=r.length;i<rl;i++){var node=r[i],parentNode=node.parentNode,id=jQuery.data(parentNode);if(!merge[id]){var c=1;for(var n=parentNode.firstChild;n;n=n.nextSibling)if(n.nodeType==1)n.nodeIndex=c++;merge[id]=true;}var add=false;if(first==0){if(node.nodeIndex==last)add=true;}else if((node.nodeIndex-last)%first==0&&(node.nodeIndex-last)/first>=0)add=true;if(add^not)tmp.push(node);}r=tmp;}else{var fn=jQuery.expr[m[1]];if(typeof fn=="object")fn=fn[m[2]];if(typeof fn=="string")fn=eval("false||function(a,i){return "+fn+";}");r=jQuery.grep(r,function(elem,i){return fn(elem,i,m,r);},not);}}return{r:r,t:t};},dir:function(elem,dir){var matched=[],cur=elem[dir];while(cur&&cur!=document){if(cur.nodeType==1)matched.push(cur);cur=cur[dir];}return matched;},nth:function(cur,result,dir,elem){result=result||1;var num=0;for(;cur;cur=cur[dir])if(cur.nodeType==1&&++num==result)break;return cur;},sibling:function(n,elem){var r=[];for(;n;n=n.nextSibling){if(n.nodeType==1&&n!=elem)r.push(n);}return r;}});jQuery.event={add:function(elem,types,handler,data){if(elem.nodeType==3||elem.nodeType==8)return;if(jQuery.browser.msie&&elem.setInterval)elem=window;if(!handler.guid)handler.guid=this.guid++;if(data!=undefined){var fn=handler;handler=this.proxy(fn,function(){return fn.apply(this,arguments);});handler.data=data;}var events=jQuery.data(elem,"events")||jQuery.data(elem,"events",{}),handle=jQuery.data(elem,"handle")||jQuery.data(elem,"handle",function(){if(typeof jQuery!="undefined"&&!jQuery.event.triggered)return jQuery.event.handle.apply(arguments.callee.elem,arguments);});handle.elem=elem;jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];handler.type=parts[1];var handlers=events[type];if(!handlers){handlers=events[type]={};if(!jQuery.event.special[type]||jQuery.event.special[type].setup.call(elem)===false){if(elem.addEventListener)elem.addEventListener(type,handle,false);else if(elem.attachEvent)elem.attachEvent("on"+type,handle);}}handlers[handler.guid]=handler;jQuery.event.global[type]=true;});elem=null;},guid:1,global:{},remove:function(elem,types,handler){if(elem.nodeType==3||elem.nodeType==8)return;var events=jQuery.data(elem,"events"),ret,index;if(events){if(types==undefined||(typeof types=="string"&&types.charAt(0)=="."))for(var type in events)this.remove(elem,type+(types||""));else{if(types.type){handler=types.handler;types=types.type;}jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];if(events[type]){if(handler)delete events[type][handler.guid];else
-for(handler in events[type])if(!parts[1]||events[type][handler].type==parts[1])delete events[type][handler];for(ret in events[type])break;if(!ret){if(!jQuery.event.special[type]||jQuery.event.special[type].teardown.call(elem)===false){if(elem.removeEventListener)elem.removeEventListener(type,jQuery.data(elem,"handle"),false);else if(elem.detachEvent)elem.detachEvent("on"+type,jQuery.data(elem,"handle"));}ret=null;delete events[type];}}});}for(ret in events)break;if(!ret){var handle=jQuery.data(elem,"handle");if(handle)handle.elem=null;jQuery.removeData(elem,"events");jQuery.removeData(elem,"handle");}}},trigger:function(type,data,elem,donative,extra){data=jQuery.makeArray(data);if(type.indexOf("!")>=0){type=type.slice(0,-1);var exclusive=true;}if(!elem){if(this.global[type])jQuery("*").add([window,document]).trigger(type,data);}else{if(elem.nodeType==3||elem.nodeType==8)return undefined;var val,ret,fn=jQuery.isFunction(elem[type]||null),event=!data[0]||!data[0].preventDefault;if(event){data.unshift({type:type,target:elem,preventDefault:function(){},stopPropagation:function(){},timeStamp:now()});data[0][expando]=true;}data[0].type=type;if(exclusive)data[0].exclusive=true;var handle=jQuery.data(elem,"handle");if(handle)val=handle.apply(elem,data);if((!fn||(jQuery.nodeName(elem,'a')&&type=="click"))&&elem["on"+type]&&elem["on"+type].apply(elem,data)===false)val=false;if(event)data.shift();if(extra&&jQuery.isFunction(extra)){ret=extra.apply(elem,val==null?data:data.concat(val));if(ret!==undefined)val=ret;}if(fn&&donative!==false&&val!==false&&!(jQuery.nodeName(elem,'a')&&type=="click")){this.triggered=true;try{elem[type]();}catch(e){}}this.triggered=false;}return val;},handle:function(event){var val,ret,namespace,all,handlers;event=arguments[0]=jQuery.event.fix(event||window.event);namespace=event.type.split(".");event.type=namespace[0];namespace=namespace[1];all=!namespace&&!event.exclusive;handlers=(jQuery.data(this,"events")||{})[event.type];for(var j in handlers){var handler=handlers[j];if(all||handler.type==namespace){event.handler=handler;event.data=handler.data;ret=handler.apply(this,arguments);if(val!==false)val=ret;if(ret===false){event.preventDefault();event.stopPropagation();}}}return val;},fix:function(event){if(event[expando]==true)return event;var originalEvent=event;event={originalEvent:originalEvent};var props="altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target timeStamp toElement type view wheelDelta which".split(" ");for(var i=props.length;i;i--)event[props[i]]=originalEvent[props[i]];event[expando]=true;event.preventDefault=function(){if(originalEvent.preventDefault)originalEvent.preventDefault();originalEvent.returnValue=false;};event.stopPropagation=function(){if(originalEvent.stopPropagation)originalEvent.stopPropagation();originalEvent.cancelBubble=true;};event.timeStamp=event.timeStamp||now();if(!event.target)event.target=event.srcElement||document;if(event.target.nodeType==3)event.target=event.target.parentNode;if(!event.relatedTarget&&event.fromElement)event.relatedTarget=event.fromElement==event.target?event.toElement:event.fromElement;if(event.pageX==null&&event.clientX!=null){var doc=document.documentElement,body=document.body;event.pageX=event.clientX+(doc&&doc.scrollLeft||body&&body.scrollLeft||0)-(doc.clientLeft||0);event.pageY=event.clientY+(doc&&doc.scrollTop||body&&body.scrollTop||0)-(doc.clientTop||0);}if(!event.which&&((event.charCode||event.charCode===0)?event.charCode:event.keyCode))event.which=event.charCode||event.keyCode;if(!event.metaKey&&event.ctrlKey)event.metaKey=event.ctrlKey;if(!event.which&&event.button)event.which=(event.button&1?1:(event.button&2?3:(event.button&4?2:0)));return event;},proxy:function(fn,proxy){proxy.guid=fn.guid=fn.guid||proxy.guid||this.guid++;return proxy;},special:{ready:{setup:function(){bindReady();return;},teardown:function(){return;}},mouseenter:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseover",jQuery.event.special.mouseenter.handler);return true;},teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseover",jQuery.event.special.mouseenter.handler);return true;},handler:function(event){if(withinElement(event,this))return true;event.type="mouseenter";return jQuery.event.handle.apply(this,arguments);}},mouseleave:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseout",jQuery.event.special.mouseleave.handler);return true;},teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseout",jQuery.event.special.mouseleave.handler);return true;},handler:function(event){if(withinElement(event,this))return true;event.type="mouseleave";return jQuery.event.handle.apply(this,arguments);}}}};jQuery.fn.extend({bind:function(type,data,fn){return type=="unload"?this.one(type,data,fn):this.each(function(){jQuery.event.add(this,type,fn||data,fn&&data);});},one:function(type,data,fn){var one=jQuery.event.proxy(fn||data,function(event){jQuery(this).unbind(event,one);return(fn||data).apply(this,arguments);});return this.each(function(){jQuery.event.add(this,type,one,fn&&data);});},unbind:function(type,fn){return this.each(function(){jQuery.event.remove(this,type,fn);});},trigger:function(type,data,fn){return this.each(function(){jQuery.event.trigger(type,data,this,true,fn);});},triggerHandler:function(type,data,fn){return this[0]&&jQuery.event.trigger(type,data,this[0],false,fn);},toggle:function(fn){var args=arguments,i=1;while(i<args.length)jQuery.event.proxy(fn,args[i++]);return this.click(jQuery.event.proxy(fn,function(event){this.lastToggle=(this.lastToggle||0)%i;event.preventDefault();return args[this.lastToggle++].apply(this,arguments)||false;}));},hover:function(fnOver,fnOut){return this.bind('mouseenter',fnOver).bind('mouseleave',fnOut);},ready:function(fn){bindReady();if(jQuery.isReady)fn.call(document,jQuery);else
-jQuery.readyList.push(function(){return fn.call(this,jQuery);});return this;}});jQuery.extend({isReady:false,readyList:[],ready:function(){if(!jQuery.isReady){jQuery.isReady=true;if(jQuery.readyList){jQuery.each(jQuery.readyList,function(){this.call(document);});jQuery.readyList=null;}jQuery(document).triggerHandler("ready");}}});var readyBound=false;function bindReady(){if(readyBound)return;readyBound=true;if(document.addEventListener&&!jQuery.browser.opera)document.addEventListener("DOMContentLoaded",jQuery.ready,false);if(jQuery.browser.msie&&window==top)(function(){if(jQuery.isReady)return;try{document.documentElement.doScroll("left");}catch(error){setTimeout(arguments.callee,0);return;}jQuery.ready();})();if(jQuery.browser.opera)document.addEventListener("DOMContentLoaded",function(){if(jQuery.isReady)return;for(var i=0;i<document.styleSheets.length;i++)if(document.styleSheets[i].disabled){setTimeout(arguments.callee,0);return;}jQuery.ready();},false);if(jQuery.browser.safari){var numStyles;(function(){if(jQuery.isReady)return;if(document.readyState!="loaded"&&document.readyState!="complete"){setTimeout(arguments.callee,0);return;}if(numStyles===undefined)numStyles=jQuery("style, link[rel=stylesheet]").length;if(document.styleSheets.length!=numStyles){setTimeout(arguments.callee,0);return;}jQuery.ready();})();}jQuery.event.add(window,"load",jQuery.ready);}jQuery.each(("blur,focus,load,resize,scroll,unload,click,dblclick,"+"mousedown,mouseup,mousemove,mouseover,mouseout,change,select,"+"submit,keydown,keypress,keyup,error").split(","),function(i,name){jQuery.fn[name]=function(fn){return fn?this.bind(name,fn):this.trigger(name);};});var withinElement=function(event,elem){var parent=event.relatedTarget;while(parent&&parent!=elem)try{parent=parent.parentNode;}catch(error){parent=elem;}return parent==elem;};jQuery(window).bind("unload",function(){jQuery("*").add(document).unbind();});jQuery.fn.extend({_load:jQuery.fn.load,load:function(url,params,callback){if(typeof url!='string')return this._load(url);var off=url.indexOf(" ");if(off>=0){var selector=url.slice(off,url.length);url=url.slice(0,off);}callback=callback||function(){};var type="GET";if(params)if(jQuery.isFunction(params)){callback=params;params=null;}else{params=jQuery.param(params);type="POST";}var self=this;jQuery.ajax({url:url,type:type,dataType:"html",data:params,complete:function(res,status){if(status=="success"||status=="notmodified")self.html(selector?jQuery("<div/>").append(res.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(selector):res.responseText);self.each(callback,[res.responseText,status,res]);}});return this;},serialize:function(){return jQuery.param(this.serializeArray());},serializeArray:function(){return this.map(function(){return jQuery.nodeName(this,"form")?jQuery.makeArray(this.elements):this;}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password/i.test(this.type));}).map(function(i,elem){var val=jQuery(this).val();return val==null?null:val.constructor==Array?jQuery.map(val,function(val,i){return{name:elem.name,value:val};}):{name:elem.name,value:val};}).get();}});jQuery.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(i,o){jQuery.fn[o]=function(f){return this.bind(o,f);};});var jsc=now();jQuery.extend({get:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data=null;}return jQuery.ajax({type:"GET",url:url,data:data,success:callback,dataType:type});},getScript:function(url,callback){return jQuery.get(url,null,callback,"script");},getJSON:function(url,data,callback){return jQuery.get(url,data,callback,"json");},post:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data={};}return jQuery.ajax({type:"POST",url:url,data:data,success:callback,dataType:type});},ajaxSetup:function(settings){jQuery.extend(jQuery.ajaxSettings,settings);},ajaxSettings:{url:location.href,global:true,type:"GET",timeout:0,contentType:"application/x-www-form-urlencoded",processData:true,async:true,data:null,username:null,password:null,accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(s){s=jQuery.extend(true,s,jQuery.extend(true,{},jQuery.ajaxSettings,s));var jsonp,jsre=/=\?(&|$)/g,status,data,type=s.type.toUpperCase();if(s.data&&s.processData&&typeof s.data!="string")s.data=jQuery.param(s.data);if(s.dataType=="jsonp"){if(type=="GET"){if(!s.url.match(jsre))s.url+=(s.url.match(/\?/)?"&":"?")+(s.jsonp||"callback")+"=?";}else if(!s.data||!s.data.match(jsre))s.data=(s.data?s.data+"&":"")+(s.jsonp||"callback")+"=?";s.dataType="json";}if(s.dataType=="json"&&(s.data&&s.data.match(jsre)||s.url.match(jsre))){jsonp="jsonp"+jsc++;if(s.data)s.data=(s.data+"").replace(jsre,"="+jsonp+"$1");s.url=s.url.replace(jsre,"="+jsonp+"$1");s.dataType="script";window[jsonp]=function(tmp){data=tmp;success();complete();window[jsonp]=undefined;try{delete window[jsonp];}catch(e){}if(head)head.removeChild(script);};}if(s.dataType=="script"&&s.cache==null)s.cache=false;if(s.cache===false&&type=="GET"){var ts=now();var ret=s.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+ts+"$2");s.url=ret+((ret==s.url)?(s.url.match(/\?/)?"&":"?")+"_="+ts:"");}if(s.data&&type=="GET"){s.url+=(s.url.match(/\?/)?"&":"?")+s.data;s.data=null;}if(s.global&&!jQuery.active++)jQuery.event.trigger("ajaxStart");var remote=/^(?:\w+:)?\/\/([^\/?#]+)/;if(s.dataType=="script"&&type=="GET"&&remote.test(s.url)&&remote.exec(s.url)[1]!=location.host){var head=document.getElementsByTagName("head")[0];var script=document.createElement("script");script.src=s.url;if(s.scriptCharset)script.charset=s.scriptCharset;if(!jsonp){var done=false;script.onload=script.onreadystatechange=function(){if(!done&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){done=true;success();complete();head.removeChild(script);}};}head.appendChild(script);return undefined;}var requestDone=false;var xhr=window.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest();if(s.username)xhr.open(type,s.url,s.async,s.username,s.password);else
-xhr.open(type,s.url,s.async);try{if(s.data)xhr.setRequestHeader("Content-Type",s.contentType);if(s.ifModified)xhr.setRequestHeader("If-Modified-Since",jQuery.lastModified[s.url]||"Thu, 01 Jan 1970 00:00:00 GMT");xhr.setRequestHeader("X-Requested-With","XMLHttpRequest");xhr.setRequestHeader("Accept",s.dataType&&s.accepts[s.dataType]?s.accepts[s.dataType]+", */*":s.accepts._default);}catch(e){}if(s.beforeSend&&s.beforeSend(xhr,s)===false){s.global&&jQuery.active--;xhr.abort();return false;}if(s.global)jQuery.event.trigger("ajaxSend",[xhr,s]);var onreadystatechange=function(isTimeout){if(!requestDone&&xhr&&(xhr.readyState==4||isTimeout=="timeout")){requestDone=true;if(ival){clearInterval(ival);ival=null;}status=isTimeout=="timeout"&&"timeout"||!jQuery.httpSuccess(xhr)&&"error"||s.ifModified&&jQuery.httpNotModified(xhr,s.url)&&"notmodified"||"success";if(status=="success"){try{data=jQuery.httpData(xhr,s.dataType,s.dataFilter);}catch(e){status="parsererror";}}if(status=="success"){var modRes;try{modRes=xhr.getResponseHeader("Last-Modified");}catch(e){}if(s.ifModified&&modRes)jQuery.lastModified[s.url]=modRes;if(!jsonp)success();}else
-jQuery.handleError(s,xhr,status);complete();if(s.async)xhr=null;}};if(s.async){var ival=setInterval(onreadystatechange,13);if(s.timeout>0)setTimeout(function(){if(xhr){xhr.abort();if(!requestDone)onreadystatechange("timeout");}},s.timeout);}try{xhr.send(s.data);}catch(e){jQuery.handleError(s,xhr,null,e);}if(!s.async)onreadystatechange();function success(){if(s.success)s.success(data,status);if(s.global)jQuery.event.trigger("ajaxSuccess",[xhr,s]);}function complete(){if(s.complete)s.complete(xhr,status);if(s.global)jQuery.event.trigger("ajaxComplete",[xhr,s]);if(s.global&&!--jQuery.active)jQuery.event.trigger("ajaxStop");}return xhr;},handleError:function(s,xhr,status,e){if(s.error)s.error(xhr,status,e);if(s.global)jQuery.event.trigger("ajaxError",[xhr,s,e]);},active:0,httpSuccess:function(xhr){try{return!xhr.status&&location.protocol=="file:"||(xhr.status>=200&&xhr.status<300)||xhr.status==304||xhr.status==1223||jQuery.browser.safari&&xhr.status==undefined;}catch(e){}return false;},httpNotModified:function(xhr,url){try{var xhrRes=xhr.getResponseHeader("Last-Modified");return xhr.status==304||xhrRes==jQuery.lastModified[url]||jQuery.browser.safari&&xhr.status==undefined;}catch(e){}return false;},httpData:function(xhr,type,filter){var ct=xhr.getResponseHeader("content-type"),xml=type=="xml"||!type&&ct&&ct.indexOf("xml")>=0,data=xml?xhr.responseXML:xhr.responseText;if(xml&&data.documentElement.tagName=="parsererror")throw"parsererror";if(filter)data=filter(data,type);if(type=="script")jQuery.globalEval(data);if(type=="json")data=eval("("+data+")");return data;},param:function(a){var s=[];if(a.constructor==Array||a.jquery)jQuery.each(a,function(){s.push(encodeURIComponent(this.name)+"="+encodeURIComponent(this.value));});else
-for(var j in a)if(a[j]&&a[j].constructor==Array)jQuery.each(a[j],function(){s.push(encodeURIComponent(j)+"="+encodeURIComponent(this));});else
-s.push(encodeURIComponent(j)+"="+encodeURIComponent(jQuery.isFunction(a[j])?a[j]():a[j]));return s.join("&").replace(/%20/g,"+");}});jQuery.fn.extend({show:function(speed,callback){return speed?this.animate({height:"show",width:"show",opacity:"show"},speed,callback):this.filter(":hidden").each(function(){this.style.display=this.oldblock||"";if(jQuery.css(this,"display")=="none"){var elem=jQuery("<"+this.tagName+" />").appendTo("body");this.style.display=elem.css("display");if(this.style.display=="none")this.style.display="block";elem.remove();}}).end();},hide:function(speed,callback){return speed?this.animate({height:"hide",width:"hide",opacity:"hide"},speed,callback):this.filter(":visible").each(function(){this.oldblock=this.oldblock||jQuery.css(this,"display");this.style.display="none";}).end();},_toggle:jQuery.fn.toggle,toggle:function(fn,fn2){return jQuery.isFunction(fn)&&jQuery.isFunction(fn2)?this._toggle.apply(this,arguments):fn?this.animate({height:"toggle",width:"toggle",opacity:"toggle"},fn,fn2):this.each(function(){jQuery(this)[jQuery(this).is(":hidden")?"show":"hide"]();});},slideDown:function(speed,callback){return this.animate({height:"show"},speed,callback);},slideUp:function(speed,callback){return this.animate({height:"hide"},speed,callback);},slideToggle:function(speed,callback){return this.animate({height:"toggle"},speed,callback);},fadeIn:function(speed,callback){return this.animate({opacity:"show"},speed,callback);},fadeOut:function(speed,callback){return this.animate({opacity:"hide"},speed,callback);},fadeTo:function(speed,to,callback){return this.animate({opacity:to},speed,callback);},animate:function(prop,speed,easing,callback){var optall=jQuery.speed(speed,easing,callback);return this[optall.queue===false?"each":"queue"](function(){if(this.nodeType!=1)return false;var opt=jQuery.extend({},optall),p,hidden=jQuery(this).is(":hidden"),self=this;for(p in prop){if(prop[p]=="hide"&&hidden||prop[p]=="show"&&!hidden)return opt.complete.call(this);if(p=="height"||p=="width"){opt.display=jQuery.css(this,"display");opt.overflow=this.style.overflow;}}if(opt.overflow!=null)this.style.overflow="hidden";opt.curAnim=jQuery.extend({},prop);jQuery.each(prop,function(name,val){var e=new jQuery.fx(self,opt,name);if(/toggle|show|hide/.test(val))e[val=="toggle"?hidden?"show":"hide":val](prop);else{var parts=val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),start=e.cur(true)||0;if(parts){var end=parseFloat(parts[2]),unit=parts[3]||"px";if(unit!="px"){self.style[name]=(end||1)+unit;start=((end||1)/e.cur(true))*start;self.style[name]=start+unit;}if(parts[1])end=((parts[1]=="-="?-1:1)*end)+start;e.custom(start,end,unit);}else
-e.custom(start,val,"");}});return true;});},queue:function(type,fn){if(jQuery.isFunction(type)||(type&&type.constructor==Array)){fn=type;type="fx";}if(!type||(typeof type=="string"&&!fn))return queue(this[0],type);return this.each(function(){if(fn.constructor==Array)queue(this,type,fn);else{queue(this,type).push(fn);if(queue(this,type).length==1)fn.call(this);}});},stop:function(clearQueue,gotoEnd){var timers=jQuery.timers;if(clearQueue)this.queue([]);this.each(function(){for(var i=timers.length-1;i>=0;i--)if(timers[i].elem==this){if(gotoEnd)timers[i](true);timers.splice(i,1);}});if(!gotoEnd)this.dequeue();return this;}});var queue=function(elem,type,array){if(elem){type=type||"fx";var q=jQuery.data(elem,type+"queue");if(!q||array)q=jQuery.data(elem,type+"queue",jQuery.makeArray(array));}return q;};jQuery.fn.dequeue=function(type){type=type||"fx";return this.each(function(){var q=queue(this,type);q.shift();if(q.length)q[0].call(this);});};jQuery.extend({speed:function(speed,easing,fn){var opt=speed&&speed.constructor==Object?speed:{complete:fn||!fn&&easing||jQuery.isFunction(speed)&&speed,duration:speed,easing:fn&&easing||easing&&easing.constructor!=Function&&easing};opt.duration=(opt.duration&&opt.duration.constructor==Number?opt.duration:jQuery.fx.speeds[opt.duration])||jQuery.fx.speeds.def;opt.old=opt.complete;opt.complete=function(){if(opt.queue!==false)jQuery(this).dequeue();if(jQuery.isFunction(opt.old))opt.old.call(this);};return opt;},easing:{linear:function(p,n,firstNum,diff){return firstNum+diff*p;},swing:function(p,n,firstNum,diff){return((-Math.cos(p*Math.PI)/2)+0.5)*diff+firstNum;}},timers:[],timerId:null,fx:function(elem,options,prop){this.options=options;this.elem=elem;this.prop=prop;if(!options.orig)options.orig={};}});jQuery.fx.prototype={update:function(){if(this.options.step)this.options.step.call(this.elem,this.now,this);(jQuery.fx.step[this.prop]||jQuery.fx.step._default)(this);if(this.prop=="height"||this.prop=="width")this.elem.style.display="block";},cur:function(force){if(this.elem[this.prop]!=null&&this.elem.style[this.prop]==null)return this.elem[this.prop];var r=parseFloat(jQuery.css(this.elem,this.prop,force));return r&&r>-10000?r:parseFloat(jQuery.curCSS(this.elem,this.prop))||0;},custom:function(from,to,unit){this.startTime=now();this.start=from;this.end=to;this.unit=unit||this.unit||"px";this.now=this.start;this.pos=this.state=0;this.update();var self=this;function t(gotoEnd){return self.step(gotoEnd);}t.elem=this.elem;jQuery.timers.push(t);if(jQuery.timerId==null){jQuery.timerId=setInterval(function(){var timers=jQuery.timers;for(var i=0;i<timers.length;i++)if(!timers[i]())timers.splice(i--,1);if(!timers.length){clearInterval(jQuery.timerId);jQuery.timerId=null;}},13);}},show:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);this.options.show=true;this.custom(0,this.cur());if(this.prop=="width"||this.prop=="height")this.elem.style[this.prop]="1px";jQuery(this.elem).show();},hide:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0);},step:function(gotoEnd){var t=now();if(gotoEnd||t>this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var done=true;for(var i in this.options.curAnim)if(this.options.curAnim[i]!==true)done=false;if(done){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(jQuery.css(this.elem,"display")=="none")this.elem.style.display="block";}if(this.options.hide)this.elem.style.display="none";if(this.options.hide||this.options.show)for(var p in this.options.curAnim)jQuery.attr(this.elem.style,p,this.options.orig[p]);}if(done)this.options.complete.call(this.elem);return false;}else{var n=t-this.startTime;this.state=n/this.options.duration;this.pos=jQuery.easing[this.options.easing||(jQuery.easing.swing?"swing":"linear")](this.state,n,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update();}return true;}};jQuery.extend(jQuery.fx,{speeds:{slow:600,fast:200,def:400},step:{scrollLeft:function(fx){fx.elem.scrollLeft=fx.now;},scrollTop:function(fx){fx.elem.scrollTop=fx.now;},opacity:function(fx){jQuery.attr(fx.elem.style,"opacity",fx.now);},_default:function(fx){fx.elem.style[fx.prop]=fx.now+fx.unit;}}});jQuery.fn.offset=function(){var left=0,top=0,elem=this[0],results;if(elem)with(jQuery.browser){var parent=elem.parentNode,offsetChild=elem,offsetParent=elem.offsetParent,doc=elem.ownerDocument,safari2=safari&&parseInt(version)<522&&!/adobeair/i.test(userAgent),css=jQuery.curCSS,fixed=css(elem,"position")=="fixed";if(elem.getBoundingClientRect){var box=elem.getBoundingClientRect();add(box.left+Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),box.top+Math.max(doc.documentElement.scrollTop,doc.body.scrollTop));add(-doc.documentElement.clientLeft,-doc.documentElement.clientTop);}else{add(elem.offsetLeft,elem.offsetTop);while(offsetParent){add(offsetParent.offsetLeft,offsetParent.offsetTop);if(mozilla&&!/^t(able|d|h)$/i.test(offsetParent.tagName)||safari&&!safari2)border(offsetParent);if(!fixed&&css(offsetParent,"position")=="fixed")fixed=true;offsetChild=/^body$/i.test(offsetParent.tagName)?offsetChild:offsetParent;offsetParent=offsetParent.offsetParent;}while(parent&&parent.tagName&&!/^body|html$/i.test(parent.tagName)){if(!/^inline|table.*$/i.test(css(parent,"display")))add(-parent.scrollLeft,-parent.scrollTop);if(mozilla&&css(parent,"overflow")!="visible")border(parent);parent=parent.parentNode;}if((safari2&&(fixed||css(offsetChild,"position")=="absolute"))||(mozilla&&css(offsetChild,"position")!="absolute"))add(-doc.body.offsetLeft,-doc.body.offsetTop);if(fixed)add(Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),Math.max(doc.documentElement.scrollTop,doc.body.scrollTop));}results={top:top,left:left};}function border(elem){add(jQuery.curCSS(elem,"borderLeftWidth",true),jQuery.curCSS(elem,"borderTopWidth",true));}function add(l,t){left+=parseInt(l,10)||0;top+=parseInt(t,10)||0;}return results;};jQuery.fn.extend({position:function(){var left=0,top=0,results;if(this[0]){var offsetParent=this.offsetParent(),offset=this.offset(),parentOffset=/^body|html$/i.test(offsetParent[0].tagName)?{top:0,left:0}:offsetParent.offset();offset.top-=num(this,'marginTop');offset.left-=num(this,'marginLeft');parentOffset.top+=num(offsetParent,'borderTopWidth');parentOffset.left+=num(offsetParent,'borderLeftWidth');results={top:offset.top-parentOffset.top,left:offset.left-parentOffset.left};}return results;},offsetParent:function(){var offsetParent=this[0].offsetParent;while(offsetParent&&(!/^body|html$/i.test(offsetParent.tagName)&&jQuery.css(offsetParent,'position')=='static'))offsetParent=offsetParent.offsetParent;return jQuery(offsetParent);}});jQuery.each(['Left','Top'],function(i,name){var method='scroll'+name;jQuery.fn[method]=function(val){if(!this[0])return;return val!=undefined?this.each(function(){this==window||this==document?window.scrollTo(!i?val:jQuery(window).scrollLeft(),i?val:jQuery(window).scrollTop()):this[method]=val;}):this[0]==window||this[0]==document?self[i?'pageYOffset':'pageXOffset']||jQuery.boxModel&&document.documentElement[method]||document.body[method]:this[0][method];};});jQuery.each(["Height","Width"],function(i,name){var tl=i?"Left":"Top",br=i?"Right":"Bottom";jQuery.fn["inner"+name]=function(){return this[name.toLowerCase()]()+num(this,"padding"+tl)+num(this,"padding"+br);};jQuery.fn["outer"+name]=function(margin){return this["inner"+name]()+num(this,"border"+tl+"Width")+num(this,"border"+br+"Width")+(margin?num(this,"margin"+tl)+num(this,"margin"+br):0);};});})();
\ No newline at end of file
deleted file mode 100644
index da1c5620d10c047525a467a425abe9ff5269cfc2..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index 1081dc1439fb984dfa7ef627afe3c7dc476fdbce..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index b3cb37425ea68b39ffa7b2e5fb69161275a87541..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
--- a/mail/test/resources/mozmill/docs/_build/html/_static/pygments.css
+++ /dev/null
@@ -1,61 +0,0 @@
-.hll { background-color: #ffffcc }
-.c { color: #408090; font-style: italic } /* Comment */
-.err { border: 1px solid #FF0000 } /* Error */
-.k { color: #007020; font-weight: bold } /* Keyword */
-.o { color: #666666 } /* Operator */
-.cm { color: #408090; font-style: italic } /* Comment.Multiline */
-.cp { color: #007020 } /* Comment.Preproc */
-.c1 { color: #408090; font-style: italic } /* Comment.Single */
-.cs { color: #408090; background-color: #fff0f0 } /* Comment.Special */
-.gd { color: #A00000 } /* Generic.Deleted */
-.ge { font-style: italic } /* Generic.Emph */
-.gr { color: #FF0000 } /* Generic.Error */
-.gh { color: #000080; font-weight: bold } /* Generic.Heading */
-.gi { color: #00A000 } /* Generic.Inserted */
-.go { color: #303030 } /* Generic.Output */
-.gp { color: #c65d09; font-weight: bold } /* Generic.Prompt */
-.gs { font-weight: bold } /* Generic.Strong */
-.gu { color: #800080; font-weight: bold } /* Generic.Subheading */
-.gt { color: #0040D0 } /* Generic.Traceback */
-.kc { color: #007020; font-weight: bold } /* Keyword.Constant */
-.kd { color: #007020; font-weight: bold } /* Keyword.Declaration */
-.kn { color: #007020; font-weight: bold } /* Keyword.Namespace */
-.kp { color: #007020 } /* Keyword.Pseudo */
-.kr { color: #007020; font-weight: bold } /* Keyword.Reserved */
-.kt { color: #902000 } /* Keyword.Type */
-.m { color: #208050 } /* Literal.Number */
-.s { color: #4070a0 } /* Literal.String */
-.na { color: #4070a0 } /* Name.Attribute */
-.nb { color: #007020 } /* Name.Builtin */
-.nc { color: #0e84b5; font-weight: bold } /* Name.Class */
-.no { color: #60add5 } /* Name.Constant */
-.nd { color: #555555; font-weight: bold } /* Name.Decorator */
-.ni { color: #d55537; font-weight: bold } /* Name.Entity */
-.ne { color: #007020 } /* Name.Exception */
-.nf { color: #06287e } /* Name.Function */
-.nl { color: #002070; font-weight: bold } /* Name.Label */
-.nn { color: #0e84b5; font-weight: bold } /* Name.Namespace */
-.nt { color: #062873; font-weight: bold } /* Name.Tag */
-.nv { color: #bb60d5 } /* Name.Variable */
-.ow { color: #007020; font-weight: bold } /* Operator.Word */
-.w { color: #bbbbbb } /* Text.Whitespace */
-.mf { color: #208050 } /* Literal.Number.Float */
-.mh { color: #208050 } /* Literal.Number.Hex */
-.mi { color: #208050 } /* Literal.Number.Integer */
-.mo { color: #208050 } /* Literal.Number.Oct */
-.sb { color: #4070a0 } /* Literal.String.Backtick */
-.sc { color: #4070a0 } /* Literal.String.Char */
-.sd { color: #4070a0; font-style: italic } /* Literal.String.Doc */
-.s2 { color: #4070a0 } /* Literal.String.Double */
-.se { color: #4070a0; font-weight: bold } /* Literal.String.Escape */
-.sh { color: #4070a0 } /* Literal.String.Heredoc */
-.si { color: #70a0d0; font-style: italic } /* Literal.String.Interpol */
-.sx { color: #c65d09 } /* Literal.String.Other */
-.sr { color: #235388 } /* Literal.String.Regex */
-.s1 { color: #4070a0 } /* Literal.String.Single */
-.ss { color: #517918 } /* Literal.String.Symbol */
-.bp { color: #007020 } /* Name.Builtin.Pseudo */
-.vc { color: #bb60d5 } /* Name.Variable.Class */
-.vg { color: #bb60d5 } /* Name.Variable.Global */
-.vi { color: #bb60d5 } /* Name.Variable.Instance */
-.il { color: #208050 } /* Literal.Number.Integer.Long */
\ No newline at end of file
deleted file mode 100644
--- a/mail/test/resources/mozmill/docs/_build/html/_static/rightsidebar.css
+++ /dev/null
@@ -1,16 +0,0 @@
-/**
- * Sphinx Doc Design -- Right Side Bar Overrides
- */
-
-
-div.sphinxsidebar {
- float: right;
-}
-
-div.bodywrapper {
- margin: 0 230px 0 0;
-}
-
-div.inlinecomments {
- right: 250px;
-}
deleted file mode 100644
--- a/mail/test/resources/mozmill/docs/_build/html/_static/searchtools.js
+++ /dev/null
@@ -1,467 +0,0 @@
-/**
- * helper function to return a node containing the
- * search summary for a given text. keywords is a list
- * of stemmed words, hlwords is the list of normal, unstemmed
- * words. the first one is used to find the occurance, the
- * latter for highlighting it.
- */
-
-jQuery.makeSearchSummary = function(text, keywords, hlwords) {
- var textLower = text.toLowerCase();
- var start = 0;
- $.each(keywords, function() {
- var i = textLower.indexOf(this.toLowerCase());
- if (i > -1)
- start = i;
- });
- start = Math.max(start - 120, 0);
- var excerpt = ((start > 0) ? '...' : '') +
- $.trim(text.substr(start, 240)) +
- ((start + 240 - text.length) ? '...' : '');
- var rv = $('<div class="context"></div>').text(excerpt);
- $.each(hlwords, function() {
- rv = rv.highlightText(this, 'highlight');
- });
- return rv;
-}
-
-/**
- * Porter Stemmer
- */
-var PorterStemmer = function() {
-
- var step2list = {
- ational: 'ate',
- tional: 'tion',
- enci: 'ence',
- anci: 'ance',
- izer: 'ize',
- bli: 'ble',
- alli: 'al',
- entli: 'ent',
- eli: 'e',
- ousli: 'ous',
- ization: 'ize',
- ation: 'ate',
- ator: 'ate',
- alism: 'al',
- iveness: 'ive',
- fulness: 'ful',
- ousness: 'ous',
- aliti: 'al',
- iviti: 'ive',
- biliti: 'ble',
- logi: 'log'
- };
-
- var step3list = {
- icate: 'ic',
- ative: '',
- alize: 'al',
- iciti: 'ic',
- ical: 'ic',
- ful: '',
- ness: ''
- };
-
- var c = "[^aeiou]"; // consonant
- var v = "[aeiouy]"; // vowel
- var C = c + "[^aeiouy]*"; // consonant sequence
- var V = v + "[aeiou]*"; // vowel sequence
-
- var mgr0 = "^(" + C + ")?" + V + C; // [C]VC... is m>0
- var meq1 = "^(" + C + ")?" + V + C + "(" + V + ")?$"; // [C]VC[V] is m=1
- var mgr1 = "^(" + C + ")?" + V + C + V + C; // [C]VCVC... is m>1
- var s_v = "^(" + C + ")?" + v; // vowel in stem
-
- this.stemWord = function (w) {
- var stem;
- var suffix;
- var firstch;
- var origword = w;
-
- if (w.length < 3)
- return w;
-
- var re;
- var re2;
- var re3;
- var re4;
-
- firstch = w.substr(0,1);
- if (firstch == "y")
- w = firstch.toUpperCase() + w.substr(1);
-
- // Step 1a
- re = /^(.+?)(ss|i)es$/;
- re2 = /^(.+?)([^s])s$/;
-
- if (re.test(w))
- w = w.replace(re,"$1$2");
- else if (re2.test(w))
- w = w.replace(re2,"$1$2");
-
- // Step 1b
- re = /^(.+?)eed$/;
- re2 = /^(.+?)(ed|ing)$/;
- if (re.test(w)) {
- var fp = re.exec(w);
- re = new RegExp(mgr0);
- if (re.test(fp[1])) {
- re = /.$/;
- w = w.replace(re,"");
- }
- }
- else if (re2.test(w)) {
- var fp = re2.exec(w);
- stem = fp[1];
- re2 = new RegExp(s_v);
- if (re2.test(stem)) {
- w = stem;
- re2 = /(at|bl|iz)$/;
- re3 = new RegExp("([^aeiouylsz])\\1$");
- re4 = new RegExp("^" + C + v + "[^aeiouwxy]$");
- if (re2.test(w))
- w = w + "e";
- else if (re3.test(w)) {
- re = /.$/;
- w = w.replace(re,"");
- }
- else if (re4.test(w))
- w = w + "e";
- }
- }
-
- // Step 1c
- re = /^(.+?)y$/;
- if (re.test(w)) {
- var fp = re.exec(w);
- stem = fp[1];
- re = new RegExp(s_v);
- if (re.test(stem))
- w = stem + "i";
- }
-
- // Step 2
- re = /^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/;
- if (re.test(w)) {
- var fp = re.exec(w);
- stem = fp[1];
- suffix = fp[2];
- re = new RegExp(mgr0);
- if (re.test(stem))
- w = stem + step2list[suffix];
- }
-
- // Step 3
- re = /^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/;
- if (re.test(w)) {
- var fp = re.exec(w);
- stem = fp[1];
- suffix = fp[2];
- re = new RegExp(mgr0);
- if (re.test(stem))
- w = stem + step3list[suffix];
- }
-
- // Step 4
- re = /^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/;
- re2 = /^(.+?)(s|t)(ion)$/;
- if (re.test(w)) {
- var fp = re.exec(w);
- stem = fp[1];
- re = new RegExp(mgr1);
- if (re.test(stem))
- w = stem;
- }
- else if (re2.test(w)) {
- var fp = re2.exec(w);
- stem = fp[1] + fp[2];
- re2 = new RegExp(mgr1);
- if (re2.test(stem))
- w = stem;
- }
-
- // Step 5
- re = /^(.+?)e$/;
- if (re.test(w)) {
- var fp = re.exec(w);
- stem = fp[1];
- re = new RegExp(mgr1);
- re2 = new RegExp(meq1);
- re3 = new RegExp("^" + C + v + "[^aeiouwxy]$");
- if (re.test(stem) || (re2.test(stem) && !(re3.test(stem))))
- w = stem;
- }
- re = /ll$/;
- re2 = new RegExp(mgr1);
- if (re.test(w) && re2.test(w)) {
- re = /.$/;
- w = w.replace(re,"");
- }
-
- // and turn initial Y back to y
- if (firstch == "y")
- w = firstch.toLowerCase() + w.substr(1);
- return w;
- }
-}
-
-
-/**
- * Search Module
- */
-var Search = {
-
- _index : null,
- _queued_query : null,
- _pulse_status : -1,
-
- init : function() {
- var params = $.getQueryParameters();
- if (params.q) {
- var query = params.q[0];
- $('input[@name="q"]')[0].value = query;
- this.performSearch(query);
- }
- },
-
- /**
- * Sets the index
- */
- setIndex : function(index) {
- var q;
- this._index = index;
- if ((q = this._queued_query) !== null) {
- this._queued_query = null;
- Search.query(q);
- }
- },
-
- hasIndex : function() {
- return this._index !== null;
- },
-
- deferQuery : function(query) {
- this._queued_query = query;
- },
-
- stopPulse : function() {
- this._pulse_status = 0;
- },
-
- startPulse : function() {
- if (this._pulse_status >= 0)
- return;
- function pulse() {
- Search._pulse_status = (Search._pulse_status + 1) % 4;
- var dotString = '';
- for (var i = 0; i < Search._pulse_status; i++)
- dotString += '.';
- Search.dots.text(dotString);
- if (Search._pulse_status > -1)
- window.setTimeout(pulse, 500);
- };
- pulse();
- },
-
- /**
- * perform a search for something
- */
- performSearch : function(query) {
- // create the required interface elements
- this.out = $('#search-results');
- this.title = $('<h2>' + _('Searching') + '</h2>').appendTo(this.out);
- this.dots = $('<span></span>').appendTo(this.title);
- this.status = $('<p style="display: none"></p>').appendTo(this.out);
- this.output = $('<ul class="search"/>').appendTo(this.out);
-
- $('#search-progress').text(_('Preparing search...'));
- this.startPulse();
-
- // index already loaded, the browser was quick!
- if (this.hasIndex())
- this.query(query);
- else
- this.setQuery(query);
- },
-
- query : function(query) {
- // stem the searchterms and add them to the
- // correct list
- var stemmer = new PorterStemmer();
- var searchterms = [];
- var excluded = [];
- var hlterms = [];
- var tmp = query.split(/\s+/);
- var object = (tmp.length == 1) ? tmp[0].toLowerCase() : null;
- for (var i = 0; i < tmp.length; i++) {
- // stem the word
- var word = stemmer.stemWord(tmp[i]).toLowerCase();
- // select the correct list
- if (word[0] == '-') {
- var toAppend = excluded;
- word = word.substr(1);
- }
- else {
- var toAppend = searchterms;
- hlterms.push(tmp[i].toLowerCase());
- }
- // only add if not already in the list
- if (!$.contains(toAppend, word))
- toAppend.push(word);
- };
- var highlightstring = '?highlight=' + $.urlencode(hlterms.join(" "));
-
- console.debug('SEARCH: searching for:');
- console.info('required: ', searchterms);
- console.info('excluded: ', excluded);
-
- // prepare search
- var filenames = this._index.filenames;
- var titles = this._index.titles;
- var terms = this._index.terms;
- var descrefs = this._index.descrefs;
- var modules = this._index.modules;
- var desctypes = this._index.desctypes;
- var fileMap = {};
- var files = null;
- var objectResults = [];
- var regularResults = [];
- $('#search-progress').empty();
-
- // lookup as object
- if (object != null) {
- for (var module in modules) {
- if (module.indexOf(object) > -1) {
- fn = modules[module];
- descr = _('module, in ') + titles[fn];
- objectResults.push([filenames[fn], module, '#module-'+module, descr]);
- }
- }
- for (var prefix in descrefs) {
- for (var name in descrefs[prefix]) {
- if (name.toLowerCase().indexOf(object) > -1) {
- match = descrefs[prefix][name];
- fullname = (prefix ? prefix + '.' : '') + name;
- descr = desctypes[match[1]] + _(', in ') + titles[match[0]];
- objectResults.push([filenames[match[0]], fullname, '#'+fullname, descr]);
- }
- }
- }
- }
-
- // sort results descending
- objectResults.sort(function(a, b) {
- return (a[1] > b[1]) ? -1 : ((a[1] < b[1]) ? 1 : 0);
- });
-
-
- // perform the search on the required terms
- for (var i = 0; i < searchterms.length; i++) {
- var word = searchterms[i];
- // no match but word was a required one
- if ((files = terms[word]) == null)
- break;
- if (files.length == undefined) {
- files = [files];
- }
- // create the mapping
- for (var j = 0; j < files.length; j++) {
- var file = files[j];
- if (file in fileMap)
- fileMap[file].push(word);
- else
- fileMap[file] = [word];
- }
- }
-
- // now check if the files don't contain excluded terms
- for (var file in fileMap) {
- var valid = true;
-
- // check if all requirements are matched
- if (fileMap[file].length != searchterms.length)
- continue;
-
- // ensure that none of the excluded terms is in the
- // search result.
- for (var i = 0; i < excluded.length; i++) {
- if (terms[excluded[i]] == file ||
- $.contains(terms[excluded[i]] || [], file)) {
- valid = false;
- break;
- }
- }
-
- // if we have still a valid result we can add it
- // to the result list
- if (valid)
- regularResults.push([filenames[file], titles[file], '', null]);
- }
-
- // delete unused variables in order to not waste
- // memory until list is retrieved completely
- delete filenames, titles, terms;
-
- // now sort the regular results descending by title
- regularResults.sort(function(a, b) {
- var left = a[1].toLowerCase();
- var right = b[1].toLowerCase();
- return (left > right) ? -1 : ((left < right) ? 1 : 0);
- });
-
- // combine both
- var results = regularResults.concat(objectResults);
-
- // print the results
- var resultCount = results.length;
- function displayNextItem() {
- // results left, load the summary and display it
- if (results.length) {
- var item = results.pop();
- var listItem = $('<li style="display:none"></li>');
- listItem.append($('<a/>').attr(
- 'href',
- item[0] + DOCUMENTATION_OPTIONS.FILE_SUFFIX +
- highlightstring + item[2]).html(item[1]));
- if (item[3]) {
- listItem.append($('<span> (' + item[3] + ')</span>'));
- Search.output.append(listItem);
- listItem.slideDown(5, function() {
- displayNextItem();
- });
- } else if (DOCUMENTATION_OPTIONS.HAS_SOURCE) {
- $.get('_sources/' + item[0] + '.txt', function(data) {
- listItem.append($.makeSearchSummary(data, searchterms, hlterms));
- Search.output.append(listItem);
- listItem.slideDown(5, function() {
- displayNextItem();
- });
- });
- } else {
- // no source available, just display title
- Search.output.append(listItem);
- listItem.slideDown(5, function() {
- displayNextItem();
- });
- }
- }
- // search finished, update title and status message
- else {
- Search.stopPulse();
- Search.title.text(_('Search Results'));
- if (!resultCount)
- Search.status.text(_('Your search did not match any documents. Please make sure that all words are spelled correctly and that you\'ve selected enough categories.'));
- else
- Search.status.text(_('Search finished, found %s page(s) matching the search query.').replace('%s', resultCount));
- Search.status.fadeIn(500);
- }
- }
- displayNextItem();
- }
-}
-
-$(document).ready(function() {
- Search.init();
-});
deleted file mode 100644
--- a/mail/test/resources/mozmill/docs/_build/html/_static/sphinxdoc.css
+++ /dev/null
@@ -1,557 +0,0 @@
-/**
- * Alternate Sphinx design
- * Originally created by Armin Ronacher for Werkzeug, adapted by Georg Brandl.
- */
-
-body {
- font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'Geneva', 'Verdana', sans-serif;
- font-size: 14px;
- letter-spacing: -0.01em;
- line-height: 150%;
- text-align: center;
- /*background-color: #AFC1C4; */
- background-color: #BFD1D4;
- color: black;
- padding: 0;
- border: 1px solid #aaa;
-
- margin: 0px 80px 0px 80px;
- min-width: 740px;
-}
-
-a {
- color: #CA7900;
- text-decoration: none;
-}
-
-a:hover {
- color: #2491CF;
-}
-
-pre {
- font-family: 'Consolas', 'Deja Vu Sans Mono', 'Bitstream Vera Sans Mono', monospace;
- font-size: 0.95em;
- letter-spacing: 0.015em;
- padding: 0.5em;
- border: 1px solid #ccc;
- background-color: #f8f8f8;
-}
-
-td.linenos pre {
- padding: 0.5em 0;
- border: 0;
- background-color: transparent;
- color: #aaa;
-}
-
-table.highlighttable {
- margin-left: 0.5em;
-}
-
-table.highlighttable td {
- padding: 0 0.5em 0 0.5em;
-}
-
-cite, code, tt {
- font-family: 'Consolas', 'Deja Vu Sans Mono', 'Bitstream Vera Sans Mono', monospace;
- font-size: 0.95em;
- letter-spacing: 0.01em;
-}
-
-hr {
- border: 1px solid #abc;
- margin: 2em;
-}
-
-tt {
- background-color: #f2f2f2;
- border-bottom: 1px solid #ddd;
- color: #333;
-}
-
-tt.descname {
- background-color: transparent;
- font-weight: bold;
- font-size: 1.2em;
- border: 0;
-}
-
-tt.descclassname {
- background-color: transparent;
- border: 0;
-}
-
-tt.xref {
- background-color: transparent;
- font-weight: bold;
- border: 0;
-}
-
-a tt {
- background-color: transparent;
- font-weight: bold;
- border: 0;
- color: #CA7900;
-}
-
-a tt:hover {
- color: #2491CF;
-}
-
-.field-list ul {
- margin: 0;
- padding-left: 1em;
-}
-
-.field-list p {
- margin: 0;
-}
-
-dl {
- margin-bottom: 15px;
-}
-
-dd p {
- margin-top: 0px;
-}
-
-dd ul, dd table {
- margin-bottom: 10px;
-}
-
-dd {
- margin-top: 3px;
- margin-bottom: 10px;
- margin-left: 30px;
-}
-
-.refcount {
- color: #060;
-}
-
-dt:target,
-.highlight {
- background-color: #fbe54e;
-}
-
-dl.glossary dt {
- font-weight: bold;
- font-size: 1.1em;
-}
-
-pre {
- line-height: 120%;
-}
-
-pre a {
- color: inherit;
- text-decoration: underline;
-}
-
-.first {
- margin-top: 0 !important;
-}
-
-div.document {
- background-color: white;
- text-align: left;
- background-image: url(contents.png);
- background-repeat: repeat-x;
-}
-
-/*
-div.documentwrapper {
- width: 100%;
-}
-*/
-
-div.clearer {
- clear: both;
-}
-
-div.related h3 {
- display: none;
-}
-
-div.related ul {
- background-image: url(navigation.png);
- height: 2em;
- list-style: none;
- border-top: 1px solid #ddd;
- border-bottom: 1px solid #ddd;
- margin: 0;
- padding-left: 10px;
-}
-
-div.related ul li {
- margin: 0;
- padding: 0;
- height: 2em;
- float: left;
-}
-
-div.related ul li.right {
- float: right;
- margin-right: 5px;
-}
-
-div.related ul li a {
- margin: 0;
- padding: 0 5px 0 5px;
- line-height: 1.75em;
- color: #EE9816;
-}
-
-div.related ul li a:hover {
- color: #3CA8E7;
-}
-
-div.body {
- margin: 0;
- padding: 0.5em 20px 20px 20px;
-}
-
-div.bodywrapper {
- margin: 0 240px 0 0;
- border-right: 1px solid #ccc;
-}
-
-div.body a {
- text-decoration: underline;
-}
-
-div.sphinxsidebar {
- margin: 0;
- padding: 0.5em 15px 15px 0;
- width: 210px;
- float: right;
- text-align: left;
-/* margin-left: -100%; */
-}
-
-div.sphinxsidebar h4, div.sphinxsidebar h3 {
- margin: 1em 0 0.5em 0;
- font-size: 0.9em;
- padding: 0.1em 0 0.1em 0.5em;
- color: white;
- border: 1px solid #86989B;
- background-color: #AFC1C4;
-}
-
-div.sphinxsidebar h3 a {
- color: white;
-}
-
-div.sphinxsidebar ul {
- padding-left: 1.5em;
- margin-top: 7px;
- list-style: none;
- padding: 0;
- line-height: 130%;
-}
-
-div.sphinxsidebar ul ul {
- list-style: square;
- margin-left: 20px;
-}
-
-p {
- margin: 0.8em 0 0.5em 0;
-}
-
-p.rubric {
- font-weight: bold;
-}
-
-div.sidebar {
- margin: 0 0 0.5em 1em;
- border: 1px solid #ddb;
- padding: 7px 7px 0 7px;
- background-color: #ffe;
- width: 40%;
- float: right;
-}
-
-div.quotebar {
- background-color: #f8f8f8;
- max-width: 250px;
- float: right;
- padding: 2px 7px;
- border: 1px solid #ccc;
-}
-
-p.sidebar-title {
- font-weight: bold;
-}
-
-div.topic {
- background-color: #f8f8f8;
- border: 1px solid #ccc;
- padding: 7px 7px 0 7px;
- margin: 10px 0 10px 0;
-}
-
-p.topic-title {
- font-size: 1.1em;
- font-weight: bold;
-}
-
-h1 {
- margin: 0;
- padding: 0.7em 0 0.3em 0;
- font-size: 1.5em;
- color: #11557C;
-}
-
-h2 {
- margin: 1.3em 0 0.2em 0;
- font-size: 1.35em;
- padding: 0;
-}
-
-h3 {
- margin: 1em 0 -0.3em 0;
- font-size: 1.2em;
-}
-
-div.body h1 a, div.body h2 a, div.body h3 a, div.body h4 a, div.body h5 a, div.body h6 a {
- color: black!important;
-}
-
-h1 a.anchor, h2 a.anchor, h3 a.anchor, h4 a.anchor, h5 a.anchor, h6 a.anchor {
- display: none;
- margin: 0 0 0 0.3em;
- padding: 0 0.2em 0 0.2em;
- color: #aaa!important;
-}
-
-h1:hover a.anchor, h2:hover a.anchor, h3:hover a.anchor, h4:hover a.anchor,
-h5:hover a.anchor, h6:hover a.anchor {
- display: inline;
-}
-
-h1 a.anchor:hover, h2 a.anchor:hover, h3 a.anchor:hover, h4 a.anchor:hover,
-h5 a.anchor:hover, h6 a.anchor:hover {
- color: #777;
- background-color: #eee;
-}
-
-table {
- border-collapse: collapse;
- margin: 0 -0.5em 0 -0.5em;
-}
-
-table td, table th {
- padding: 0.2em 0.5em 0.2em 0.5em;
-}
-
-div.footer {
- background-color: #E3EFF1;
- color: #86989B;
- padding: 3px 8px 3px 0;
- clear: both;
- font-size: 0.8em;
- text-align: right;
-}
-
-div.footer a {
- color: #86989B;
- text-decoration: underline;
-}
-
-div.pagination {
- margin-top: 2em;
- padding-top: 0.5em;
- border-top: 1px solid black;
- text-align: center;
-}
-
-div.sphinxsidebar ul.toc {
- margin: 1em 0 1em 0;
- padding: 0 0 0 0.5em;
- list-style: none;
-}
-
-div.sphinxsidebar ul.toc li {
- margin: 0.5em 0 0.5em 0;
- font-size: 0.9em;
- line-height: 130%;
-}
-
-div.sphinxsidebar ul.toc li p {
- margin: 0;
- padding: 0;
-}
-
-div.sphinxsidebar ul.toc ul {
- margin: 0.2em 0 0.2em 0;
- padding: 0 0 0 1.8em;
-}
-
-div.sphinxsidebar ul.toc ul li {
- padding: 0;
-}
-
-div.admonition, div.warning {
- font-size: 0.9em;
- margin: 1em 0 0 0;
- border: 1px solid #86989B;
- background-color: #f7f7f7;
-}
-
-div.admonition p, div.warning p {
- margin: 0.5em 1em 0.5em 1em;
- padding: 0;
-}
-
-div.admonition pre, div.warning pre {
- margin: 0.4em 1em 0.4em 1em;
-}
-
-div.admonition p.admonition-title,
-div.warning p.admonition-title {
- margin: 0;
- padding: 0.1em 0 0.1em 0.5em;
- color: white;
- border-bottom: 1px solid #86989B;
- font-weight: bold;
- background-color: #AFC1C4;
-}
-
-div.warning {
- border: 1px solid #940000;
-}
-
-div.warning p.admonition-title {
- background-color: #CF0000;
- border-bottom-color: #940000;
-}
-
-div.admonition ul, div.admonition ol,
-div.warning ul, div.warning ol {
- margin: 0.1em 0.5em 0.5em 3em;
- padding: 0;
-}
-
-div.versioninfo {
- margin: 1em 0 0 0;
- border: 1px solid #ccc;
- background-color: #DDEAF0;
- padding: 8px;
- line-height: 1.3em;
- font-size: 0.9em;
-}
-
-
-a.headerlink {
- color: #c60f0f!important;
- font-size: 1em;
- margin-left: 6px;
- padding: 0 4px 0 4px;
- text-decoration: none!important;
- visibility: hidden;
-}
-
-h1:hover > a.headerlink,
-h2:hover > a.headerlink,
-h3:hover > a.headerlink,
-h4:hover > a.headerlink,
-h5:hover > a.headerlink,
-h6:hover > a.headerlink,
-dt:hover > a.headerlink {
- visibility: visible;
-}
-
-a.headerlink:hover {
- background-color: #ccc;
- color: white!important;
-}
-
-table.indextable td {
- text-align: left;
- vertical-align: top;
-}
-
-table.indextable dl, table.indextable dd {
- margin-top: 0;
- margin-bottom: 0;
-}
-
-table.indextable tr.pcap {
- height: 10px;
-}
-
-table.indextable tr.cap {
- margin-top: 10px;
- background-color: #f2f2f2;
-}
-
-img.toggler {
- margin-right: 3px;
- margin-top: 3px;
- cursor: pointer;
-}
-
-form.pfform {
- margin: 10px 0 20px 0;
-}
-
-table.contentstable {
- width: 90%;
-}
-
-table.contentstable p.biglink {
- line-height: 150%;
-}
-
-a.biglink {
- font-size: 1.3em;
-}
-
-span.linkdescr {
- font-style: italic;
- padding-top: 5px;
- font-size: 90%;
-}
-
-ul.search {
- margin: 10px 0 0 20px;
- padding: 0;
-}
-
-ul.search li {
- padding: 5px 0 5px 20px;
- background-image: url(file.png);
- background-repeat: no-repeat;
- background-position: 0 7px;
-}
-
-ul.search li a {
- font-weight: bold;
-}
-
-ul.search li div.context {
- color: #888;
- margin: 2px 0 0 30px;
- text-align: left;
-}
-
-ul.keywordmatches li.goodmatch a {
- font-weight: bold;
-}
-
-img.math {
- vertical-align: center;
-}
-
-div.math {
- text-align: center;
-}
-
-span.eqno {
- float: right;
-}
-
-img.logo {
- border: 0;
-}
deleted file mode 100644
--- a/mail/test/resources/mozmill/docs/_build/html/_static/stickysidebar.css
+++ /dev/null
@@ -1,19 +0,0 @@
-/**
- * Sphinx Doc Design -- Sticky sidebar Overrides
- */
-
-div.sphinxsidebar {
- top: 30px;
- left: 0px;
- position: fixed;
- margin: 0;
- float: none;
-}
-
-div.related {
- position: fixed;
-}
-
-div.documentwrapper {
- margin-top: 30px;
-}
deleted file mode 100644
--- a/mail/test/resources/mozmill/docs/_build/html/_static/traditional.css
+++ /dev/null
@@ -1,700 +0,0 @@
-/**
- * Sphinx Doc Design -- traditional python.org style
- */
-
-body {
- color: #000;
- margin: 0;
- padding: 0;
-}
-
-/* :::: LAYOUT :::: */
-
-div.documentwrapper {
- float: left;
- width: 100%;
-}
-
-div.bodywrapper {
- margin: 0 230px 0 0;
-}
-
-div.body {
- background-color: white;
- padding: 0 20px 30px 20px;
-}
-
-div.sphinxsidebarwrapper {
- border: 1px solid #99ccff;
- padding: 10px;
- margin: 10px 15px 10px 0;
-}
-
-div.sphinxsidebar {
- float: right;
- margin-left: -100%;
- width: 230px;
-}
-
-div.clearer {
- clear: both;
-}
-
-div.footer {
- clear: both;
- width: 100%;
- background-color: #99ccff;
- padding: 9px 0 9px 0;
- text-align: center;
-}
-
-div.related {
- background-color: #99ccff;
- color: #333;
- width: 100%;
- height: 30px;
- line-height: 30px;
- border-bottom: 5px solid white;
-}
-
-div.related h3 {
- display: none;
-}
-
-div.related ul {
- margin: 0;
- padding: 0 0 0 10px;
- list-style: none;
-}
-
-div.related li {
- display: inline;
- font-weight: bold;
-}
-
-div.related li.right {
- float: right;
- margin-right: 5px;
-}
-
-/* ::: SIDEBAR :::: */
-div.sphinxsidebar h3 {
- margin: 0;
-}
-
-div.sphinxsidebar h4 {
- margin: 5px 0 0 0;
-}
-
-div.sphinxsidebar p.topless {
- margin: 5px 10px 10px 10px;
-}
-
-div.sphinxsidebar ul {
- margin: 10px;
- margin-left: 15px;
- padding: 0;
-}
-
-div.sphinxsidebar ul ul {
- margin-top: 0;
- margin-bottom: 0;
-}
-
-div.sphinxsidebar form {
- margin-top: 10px;
-}
-
-
-/* :::: SEARCH :::: */
-ul.search {
- margin: 10px 0 0 20px;
- padding: 0;
-}
-
-ul.search li {
- padding: 5px 0 5px 20px;
- background-image: url(file.png);
- background-repeat: no-repeat;
- background-position: 0 7px;
-}
-
-ul.search li a {
- font-weight: bold;
-}
-
-ul.search li div.context {
- color: #888;
- margin: 2px 0 0 30px;
- text-align: left;
-}
-
-ul.keywordmatches li.goodmatch a {
- font-weight: bold;
-}
-
-/* :::: COMMON FORM STYLES :::: */
-
-div.actions {
- border-top: 1px solid #aaa;
- background-color: #ddd;
- margin: 10px 0 0 -20px;
- padding: 5px 0 5px 20px;
-}
-
-form dl {
- color: #333;
-}
-
-form dt {
- clear: both;
- float: left;
- min-width: 110px;
- margin-right: 10px;
- padding-top: 2px;
-}
-
-input#homepage {
- display: none;
-}
-
-div.error {
- margin: 5px 20px 0 0;
- padding: 5px;
- border: 1px solid #d00;
- /*border: 2px solid #05171e;
- background-color: #092835;
- color: white;*/
- font-weight: bold;
-}
-
-/* :::: INLINE COMMENTS :::: */
-
-div.inlinecommentswrapper {
- float: right;
- max-width: 40%;
-}
-
-div.commentmarker {
- float: right;
- background-image: url(style/comment.png);
- background-repeat: no-repeat;
- width: 25px;
- height: 25px;
- text-align: center;
- padding-top: 3px;
-}
-
-div.nocommentmarker {
- float: right;
- background-image: url(style/nocomment.png);
- background-repeat: no-repeat;
- width: 25px;
- height: 25px;
-}
-
-div.inlinecomments {
- margin-left: 10px;
- margin-bottom: 5px;
- background-color: #eee;
- border: 1px solid #ccc;
- padding: 5px;
-}
-
-div.inlinecomment {
- border-top: 1px solid #ccc;
- padding-top: 5px;
- margin-top: 5px;
-}
-
-.inlinecomments p {
- margin: 5px 0 5px 0;
-}
-
-.inlinecomments .head {
- font-weight: bold;
-}
-
-.inlinecomments .meta {
- font-style: italic;
-}
-
-
-/* :::: COMMENTS :::: */
-
-div#comments h3 {
- border-top: 1px solid #aaa;
- padding: 5px 20px 5px 20px;
- margin: 20px -20px 20px -20px;
- background-color: #ddd;
-}
-
-/*
-div#comments {
- background-color: #ccc;
- margin: 40px -20px -30px -20px;
- padding: 0 0 1px 0;
-}
-
-div#comments h4 {
- margin: 30px 0 20px 0;
- background-color: #aaa;
- border-bottom: 1px solid #09232e;
- color: #333;
-}
-
-div#comments form {
- display: block;
- margin: 0 0 0 20px;
-}
-
-div#comments textarea {
- width: 98%;
- height: 160px;
-}
-
-div#comments div.help {
- margin: 20px 20px 10px 0;
- background-color: #ccc;
- color: #333;
-}
-
-div#comments div.help p {
- margin: 0;
- padding: 0 0 10px 0;
-}
-
-div#comments input, div#comments textarea {
- font-family: 'Bitstream Vera Sans', 'Arial', sans-serif;
- font-size: 13px;
- color: black;
- background-color: #aaa;
- border: 1px solid #092835;
-}
-
-div#comments input[type="reset"],
-div#comments input[type="submit"] {
- cursor: pointer;
- font-weight: bold;
- padding: 2px;
- margin: 5px 5px 5px 0;
- background-color: #666;
- color: white;
-}
-
-div#comments div.comment {
- margin: 10px 10px 10px 20px;
- padding: 10px;
- border: 1px solid #0f3646;
- background-color: #aaa;
- color: #333;
-}
-
-div#comments div.comment p {
- margin: 5px 0 5px 0;
-}
-
-div#comments div.comment p.meta {
- font-style: italic;
- color: #444;
- text-align: right;
- margin: -5px 0 -5px 0;
-}
-
-div#comments div.comment h4 {
- margin: -10px -10px 5px -10px;
- padding: 3px;
- font-size: 15px;
- background-color: #888;
- color: white;
- border: 0;
-}
-
-div#comments div.comment pre,
-div#comments div.comment tt {
- background-color: #ddd;
- color: #111;
- border: none;
-}
-
-div#comments div.comment a {
- color: #fff;
- text-decoration: underline;
-}
-
-div#comments div.comment blockquote {
- margin: 10px;
- padding: 10px;
- border-left: 1px solid #0f3646;
- /*border: 1px solid #0f3646;
- background-color: #071c25;*/
-}
-
-div#comments em.important {
- color: #d00;
- font-weight: bold;
- font-style: normal;
-}*/
-
-/* :::: SUGGEST CHANGES :::: */
-div#suggest-changes-box input, div#suggest-changes-box textarea {
- border: 1px solid #ccc;
- background-color: white;
- color: black;
-}
-
-div#suggest-changes-box textarea {
- width: 99%;
- height: 400px;
-}
-
-
-/* :::: PREVIEW :::: */
-div.preview {
- background-image: url(style/preview.png);
- padding: 0 20px 20px 20px;
- margin-bottom: 30px;
-}
-
-
-/* :::: INDEX PAGE :::: */
-
-table.contentstable {
- width: 90%;
-}
-
-table.contentstable p.biglink {
- line-height: 150%;
-}
-
-a.biglink {
- font-size: 1.5em;
-}
-
-span.linkdescr {
- font-style: italic;
- padding-top: 5px;
-}
-
-/* :::: GENINDEX STYLES :::: */
-
-table.indextable td {
- text-align: left;
- vertical-align: top;
-}
-
-table.indextable dl, table.indextable dd {
- margin-top: 0;
- margin-bottom: 0;
-}
-
-table.indextable tr.pcap {
- height: 10px;
-}
-
-table.indextable tr.cap {
- margin-top: 10px;
- background-color: #f2f2f2;
-}
-
-img.toggler {
- margin-right: 3px;
- margin-top: 3px;
- cursor: pointer;
-}
-
-/* :::: GLOBAL STYLES :::: */
-
-p.subhead {
- font-weight: bold;
- margin-top: 20px;
-}
-
-a:link:active { color: #ff0000; }
-a:link:hover { background-color: #bbeeff; }
-a:visited:hover { background-color: #bbeeff; }
-a:visited { color: #551a8b; }
-a:link { color: #0000bb; }
-
-div.body h1,
-div.body h2,
-div.body h3,
-div.body h4,
-div.body h5,
-div.body h6 {
- font-family: avantgarde, sans-serif;
- font-weight: bold;
-}
-
-div.body h1 { font-size: 180%; }
-div.body h2 { font-size: 150%; }
-div.body h3 { font-size: 120%; }
-div.body h4 { font-size: 120%; }
-
-a.headerlink,
-a.headerlink,
-a.headerlink,
-a.headerlink,
-a.headerlink,
-a.headerlink {
- color: #c60f0f;
- font-size: 0.8em;
- padding: 0 4px 0 4px;
- text-decoration: none;
- visibility: hidden;
-}
-
-*:hover > a.headerlink,
-*:hover > a.headerlink,
-*:hover > a.headerlink,
-*:hover > a.headerlink,
-*:hover > a.headerlink,
-*:hover > a.headerlink {
- visibility: visible;
-}
-
-a.headerlink:hover,
-a.headerlink:hover,
-a.headerlink:hover,
-a.headerlink:hover,
-a.headerlink:hover,
-a.headerlink:hover {
- background-color: #c60f0f;
- color: white;
-}
-
-div.body p, div.body dd, div.body li {
- text-align: justify;
-}
-
-div.body td {
- text-align: left;
-}
-
-ul.fakelist {
- list-style: none;
- margin: 10px 0 10px 20px;
- padding: 0;
-}
-
-/* "Footnotes" heading */
-p.rubric {
- margin-top: 30px;
- font-weight: bold;
-}
-
-/* "Topics" */
-
-div.topic {
- background-color: #eee;
- border: 1px solid #ccc;
- padding: 0 7px 0 7px;
- margin: 10px 0 10px 0;
-}
-
-p.topic-title {
- font-size: 1.1em;
- font-weight: bold;
- margin-top: 10px;
-}
-
-/* Admonitions */
-
-div.admonition {
- margin-top: 10px;
- margin-bottom: 10px;
- padding: 7px;
-}
-
-div.admonition dt {
- font-weight: bold;
-}
-
-div.admonition dd {
- margin-bottom: 10px;
-}
-
-div.admonition dl {
- margin-bottom: 0;
-}
-
-div.admonition p {
- display: inline;
-}
-
-div.seealso {
- background-color: #ffc;
- border: 1px solid #ff6;
-}
-
-div.warning {
- background-color: #ffe4e4;
- border: 1px solid #f66;
-}
-
-div.note {
- background-color: #eee;
- border: 1px solid #ccc;
-}
-
-p.admonition-title {
- margin: 0px 10px 5px 0px;
- font-weight: bold;
- display: inline;
-}
-
-p.admonition-title:after {
- content: ":";
-}
-
-div.body p.centered {
- text-align: center;
- margin-top: 25px;
-}
-
-table.docutils {
- border: 0;
-}
-
-table.docutils td, table.docutils th {
- padding: 0 8px 2px 0;
- border-top: 0;
- border-left: 0;
- border-right: 0;
- border-bottom: 1px solid #aaa;
-}
-
-table.field-list td, table.field-list th {
- border: 0 !important;
-}
-
-table.footnote td, table.footnote th {
- border: 0 !important;
-}
-
-dl {
- margin-bottom: 15px;
- clear: both;
-}
-
-dd p {
- margin-top: 0px;
-}
-
-dd ul, dd table {
- margin-bottom: 10px;
-}
-
-dd {
- margin-top: 3px;
- margin-bottom: 10px;
- margin-left: 30px;
-}
-
-dl.glossary dt {
- font-weight: bold;
- font-size: 1.1em;
-}
-
-.refcount {
- color: #060;
-}
-
-th {
- text-align: left;
- padding-right: 5px;
-}
-
-pre {
- font-family: monospace;
- padding: 5px;
- color: #00008b;
- border-left: none;
- border-right: none;
-}
-
-tt {
- font-family: monospace;
- background-color: #ecf0f3;
- padding: 0 1px 0 1px;
-}
-
-tt.descname {
- background-color: transparent;
- font-weight: bold;
- font-size: 1.2em;
-}
-
-tt.descclassname {
- background-color: transparent;
-}
-
-tt.xref, a tt {
- background-color: transparent;
- font-weight: bold;
-}
-
-.footnote:target { background-color: #ffa }
-
-h1 tt, h2 tt, h3 tt, h4 tt, h5 tt, h6 tt {
- background-color: transparent;
-}
-
-.optional {
- font-size: 1.3em;
-}
-
-.versionmodified {
- font-style: italic;
-}
-
-form.comment {
- margin: 0;
- padding: 10px 30px 10px 30px;
- background-color: #eee;
-}
-
-form.comment h3 {
- background-color: #326591;
- color: white;
- margin: -10px -30px 10px -30px;
- padding: 5px;
- font-size: 1.4em;
-}
-
-form.comment input,
-form.comment textarea {
- border: 1px solid #ccc;
- padding: 2px;
- font-family: sans-serif;
- font-size: 13px;
-}
-
-form.comment input[type="text"] {
- width: 240px;
-}
-
-form.comment textarea {
- width: 100%;
- height: 200px;
- margin-bottom: 10px;
-}
-
-/* :::: PRINT :::: */
-@media print {
- div.documentwrapper {
- width: 100%;
- }
-
- div.body {
- margin: 0;
- }
-
- div.sphinxsidebar,
- div.related,
- div.footer,
- div#comments div.new-comment-box,
- #top-link {
- display: none;
- }
-}
deleted file mode 100644
--- a/mail/test/resources/mozmill/docs/_build/html/genindex.html
+++ /dev/null
@@ -1,239 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-
- <title>Index — mozmill v1.2.1a1 documentation</title>
- <link rel="stylesheet" href="_static/default.css" type="text/css" />
- <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
- <script type="text/javascript">
- var DOCUMENTATION_OPTIONS = {
- URL_ROOT: '',
- VERSION: '1.2.1a1',
- COLLAPSE_MODINDEX: false,
- FILE_SUFFIX: '.html',
- HAS_SOURCE: true
- };
- </script>
- <script type="text/javascript" src="_static/jquery.js"></script>
- <script type="text/javascript" src="_static/doctools.js"></script>
- <link rel="index" title="Index" href="" />
- <link rel="search" title="Search" href="search.html" />
- <link rel="top" title="mozmill v1.2.1a1 documentation" href="index.html" />
- </head>
- <body>
- <div class="related">
- <h3>Navigation</h3>
- <ul>
- <li class="right" style="margin-right: 10px">
- <a href="" title="General Index"
- accesskey="I">index</a></li>
- <li class="right" >
- <a href="modindex.html" title="Global Module Index"
- accesskey="M">modules</a> |</li>
- <li><a href="index.html">mozmill v1.2.1a1 documentation</a> »</li>
- </ul>
- </div>
- <div class="document">
- <div class="documentwrapper">
- <div class="bodywrapper">
- <div class="body">
-
-
- <h1 id="index">Index</h1>
-
- <a href="#Symbols"><strong>Symbols</strong></a> | <a href="#B"><strong>B</strong></a> | <a href="#C"><strong>C</strong></a> | <a href="#E"><strong>E</strong></a> | <a href="#J"><strong>J</strong></a> | <a href="#M"><strong>M</strong></a> | <a href="#P"><strong>P</strong></a> | <a href="#R"><strong>R</strong></a> | <a href="#S"><strong>S</strong></a>
-
- <hr />
-
-
-<h2 id="Symbols">Symbols</h2>
-<table width="100%" class="indextable"><tr><td width="33%" valign="top">
-<dl>
-
-<dt>--report <uri></dt>
- <dd><dl>
- <dt><a href="index.html#cmdoption--report">command line option</a></dt>
- </dl></dd>
-<dt>--show-errors</dt>
- <dd><dl>
- <dt><a href="index.html#cmdoption--show-errors">command line option</a></dt>
- </dl></dd>
-<dt>--showall</dt>
- <dd><dl>
- <dt><a href="index.html#cmdoption--showall">command line option</a></dt>
- </dl></dd>
-<dt>-b <binary>, --binary <binary></dt>
- <dd><dl>
- <dt><a href="index.html#cmdoption-b">command line option</a></dt>
- </dl></dd>
-<dt>-d <defaultprofile></dt>
- <dd><dl>
- <dt><a href="index.html#cmdoption-d">command line option</a></dt>
- </dl></dd>
-<dt>-D, --debug</dt>
- <dd><dl>
- <dt><a href="index.html#cmdoption-D">command line option</a></dt>
- </dl></dd>
-<dt>-h, --help</dt>
- <dd><dl>
- <dt><a href="index.html#cmdoption-h">command line option</a></dt>
- </dl></dd>
-<dt>-l <logfile>, --logfile <logfile></dt>
- <dd><dl>
- <dt><a href="index.html#cmdoption-l">command line option</a></dt>
- </dl></dd></dl></td><td width="33%" valign="top"><dl>
-<dt>-n, --no-new-profile</dt>
- <dd><dl>
- <dt><a href="index.html#cmdoption-n">command line option</a></dt>
- </dl></dd>
-<dt>-P <port>, --port <port></dt>
- <dd><dl>
- <dt><a href="index.html#cmdoption-P">command line option</a></dt>
- </dl></dd>
-<dt>-p <profile>, --profile <profile></dt>
- <dd><dl>
- <dt><a href="index.html#cmdoption-p">command line option</a></dt>
- </dl></dd>
-<dt>-s, --shell</dt>
- <dd><dl>
- <dt><a href="index.html#cmdoption-s">command line option</a></dt>
- </dl></dd>
-<dt>-t <test>, --test <test></dt>
- <dd><dl>
- <dt><a href="index.html#cmdoption-t">command line option</a></dt>
- </dl></dd>
-<dt>-u, --usecode</dt>
- <dd><dl>
- <dt><a href="index.html#cmdoption-u">command line option</a></dt>
- </dl></dd>
-<dt>-w <plugins>, --plugins <plugins></dt>
- <dd><dl>
- <dt><a href="index.html#cmdoption-w">command line option</a></dt>
- </dl></dd>
-</dl></td></tr></table>
-
-<h2 id="B">B</h2>
-<table width="100%" class="indextable"><tr><td width="33%" valign="top">
-<dl>
-
-<dt><a href="index.html#mozmill.MozMill.back_channel">back_channel (mozmill.MozMill attribute)</a></dt>
-<dt><a href="index.html#mozmill.MozMill.bridge">bridge (mozmill.MozMill attribute)</a></dt></dl></td><td width="33%" valign="top"><dl>
-</dl></td></tr></table>
-
-<h2 id="C">C</h2>
-<table width="100%" class="indextable"><tr><td width="33%" valign="top">
-<dl>
-
-<dt><a href="index.html#mozmill.CLI">CLI (class in mozmill)</a></dt>
-<dt>command line option</dt>
- <dd><dl>
- <dt><a href="index.html#cmdoption--report">--report <uri></a></dt>
- <dt><a href="index.html#cmdoption--show-errors">--show-errors</a></dt>
- <dt><a href="index.html#cmdoption--showall">--showall</a></dt>
- <dt><a href="index.html#cmdoption-D">-D, --debug</a></dt>
- <dt><a href="index.html#cmdoption-P">-P <port>, --port <port></a></dt>
- <dt><a href="index.html#cmdoption-b">-b <binary>, --binary <binary></a></dt>
- <dt><a href="index.html#cmdoption-d">-d <defaultprofile></a></dt>
- <dt><a href="index.html#cmdoption-h">-h, --help</a></dt>
- <dt><a href="index.html#cmdoption-l">-l <logfile>, --logfile <logfile></a></dt>
- <dt><a href="index.html#cmdoption-n">-n, --no-new-profile</a></dt>
- <dt><a href="index.html#cmdoption-p">-p <profile>, --profile <profile></a></dt>
- <dt><a href="index.html#cmdoption-s">-s, --shell</a></dt>
- <dt><a href="index.html#cmdoption-t">-t <test>, --test <test></a></dt>
- <dt><a href="index.html#cmdoption-u">-u, --usecode</a></dt>
- <dt><a href="index.html#cmdoption-w">-w <plugins>, --plugins <plugins></a></dt>
- </dl></dd></dl></td><td width="33%" valign="top"><dl>
-</dl></td></tr></table>
-
-<h2 id="E">E</h2>
-<table width="100%" class="indextable"><tr><td width="33%" valign="top">
-<dl>
-
-<dt><a href="index.html#mozmill.MozMill.endRunner_listener">endRunner_listener() (mozmill.MozMill method)</a></dt>
-<dt><a href="index.html#mozmill.MozMill.endTest_listener">endTest_listener() (mozmill.MozMill method)</a></dt></dl></td><td width="33%" valign="top"><dl>
-</dl></td></tr></table>
-
-<h2 id="J">J</h2>
-<table width="100%" class="indextable"><tr><td width="33%" valign="top">
-<dl>
-
-<dt><a href="index.html#mozmill.MozMill.jsbridge_port">jsbridge_port (mozmill.MozMill attribute)</a></dt></dl></td><td width="33%" valign="top"><dl>
-</dl></td></tr></table>
-
-<h2 id="M">M</h2>
-<table width="100%" class="indextable"><tr><td width="33%" valign="top">
-<dl>
-
-<dt><a href="index.html#mozmill.MozMill">MozMill (class in mozmill)</a></dt>
-<dt><a href="index.html#module-mozmill">mozmill (module)</a></dt></dl></td><td width="33%" valign="top"><dl>
-</dl></td></tr></table>
-
-<h2 id="P">P</h2>
-<table width="100%" class="indextable"><tr><td width="33%" valign="top">
-<dl>
-
-<dt><a href="index.html#mozmill.MozMill.profile">profile (mozmill.MozMill attribute)</a></dt>
-<dt><a href="index.html#mozmill.CLI.profile_class">profile_class (mozmill.CLI attribute)</a></dt>
- <dd><dl>
- <dt><a href="index.html#mozmill.MozMill.profile_class">(mozmill.MozMill attribute)</a></dt>
- </dl></dd></dl></td><td width="33%" valign="top"><dl>
-</dl></td></tr></table>
-
-<h2 id="R">R</h2>
-<table width="100%" class="indextable"><tr><td width="33%" valign="top">
-<dl>
-
-<dt><a href="index.html#mozmill.MozMill.run_tests">run_tests() (mozmill.MozMill method)</a></dt>
-<dt><a href="index.html#mozmill.MozMill.runner">runner (mozmill.MozMill attribute)</a></dt>
-<dt><a href="index.html#mozmill.CLI.runner_class">runner_class (mozmill.CLI attribute)</a></dt>
- <dd><dl>
- <dt><a href="index.html#mozmill.MozMill.runner_class">(mozmill.MozMill attribute)</a></dt>
- </dl></dd></dl></td><td width="33%" valign="top"><dl>
-</dl></td></tr></table>
-
-<h2 id="S">S</h2>
-<table width="100%" class="indextable"><tr><td width="33%" valign="top">
-<dl>
-
-<dt><a href="index.html#mozmill.MozMill.start">start() (mozmill.MozMill method)</a></dt></dl></td><td width="33%" valign="top"><dl>
-</dl></td></tr></table>
-
-
-
- </div>
- </div>
- </div>
- <div class="sphinxsidebar">
- <div class="sphinxsidebarwrapper">
-
-
-
- <h3>Quick search</h3>
- <form class="search" action="search.html" method="get">
- <input type="text" name="q" size="18" /> <input type="submit" value="Go" />
- <input type="hidden" name="check_keywords" value="yes" />
- <input type="hidden" name="area" value="default" />
- </form>
- </div>
- </div>
- <div class="clearer"></div>
- </div>
- <div class="related">
- <h3>Navigation</h3>
- <ul>
- <li class="right" style="margin-right: 10px">
- <a href="" title="General Index"
- accesskey="I">index</a></li>
- <li class="right" >
- <a href="modindex.html" title="Global Module Index"
- accesskey="M">modules</a> |</li>
- <li><a href="index.html">mozmill v1.2.1a1 documentation</a> »</li>
- </ul>
- </div>
- <div class="footer">
- © Copyright 2009, Mikeal Rogers <mikeal.rogers@gmail.com>.
- Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.5.1.
- </div>
- </body>
-</html>
\ No newline at end of file
deleted file mode 100644
--- a/mail/test/resources/mozmill/docs/_build/html/index.html
+++ /dev/null
@@ -1,295 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-
- <title>mozmill — Full automation of XULRunner applications. — mozmill v1.2.1a1 documentation</title>
- <link rel="stylesheet" href="_static/default.css" type="text/css" />
- <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
- <script type="text/javascript">
- var DOCUMENTATION_OPTIONS = {
- URL_ROOT: '',
- VERSION: '1.2.1a1',
- COLLAPSE_MODINDEX: false,
- FILE_SUFFIX: '.html',
- HAS_SOURCE: true
- };
- </script>
- <script type="text/javascript" src="_static/jquery.js"></script>
- <script type="text/javascript" src="_static/doctools.js"></script>
- <link rel="index" title="Index" href="genindex.html" />
- <link rel="search" title="Search" href="search.html" />
- <link rel="top" title="mozmill v1.2.1a1 documentation" href="" />
- </head>
- <body>
- <div class="related">
- <h3>Navigation</h3>
- <ul>
- <li class="right" style="margin-right: 10px">
- <a href="genindex.html" title="General Index"
- accesskey="I">index</a></li>
- <li class="right" >
- <a href="modindex.html" title="Global Module Index"
- accesskey="M">modules</a> |</li>
- <li><a href="">mozmill v1.2.1a1 documentation</a> »</li>
- </ul>
- </div>
- <div class="document">
- <div class="documentwrapper">
- <div class="bodywrapper">
- <div class="body">
-
-
- <div class="section" id="module-mozmill">
-<h1><tt class="xref docutils literal"><span class="pre">mozmill</span></tt> — Full automation of XULRunner applications.<a class="headerlink" href="#module-mozmill" title="Permalink to this headline">¶</a></h1>
-<div class="section" id="command-line-usage">
-<h2>Command Line Usage<a class="headerlink" href="#command-line-usage" title="Permalink to this headline">¶</a></h2>
-<p>The mozmill command line is versatile and includes a fair amount of debugging options. Even though all these options are available mozmill should run by default without any arguments and find your locally installed Firefox and run with mozmill.</p>
-<p>In most modes, ctrl-c will shut down Firefox and exit out of the mozmill Python side as well.</p>
-<div class="highlight-none"><div class="highlight"><pre>$ mozmill
-</pre></div>
-</div>
-<dl class="cmdoption">
-<dt id="cmdoption-h">
-<tt class="descname">-h</tt><tt class="descclassname"></tt><tt class="descclassname">, </tt><tt class="descname">--help</tt><tt class="descclassname"></tt><a class="headerlink" href="#cmdoption-h" title="Permalink to this definition">¶</a></dt>
-<dd>Show help message.</dd></dl>
-
-<dl class="cmdoption">
-<dt id="cmdoption-b">
-<tt class="descname">-b</tt><tt class="descclassname"> <binary></tt><tt class="descclassname">, </tt><tt class="descname">--binary</tt><tt class="descclassname"> <binary></tt><a class="headerlink" href="#cmdoption-b" title="Permalink to this definition">¶</a></dt>
-<dd><p>Specify application binary location.</p>
-<p>Default <a title="(in mozrunner v2.0a1)" class="reference external" href="http://mozrunner.googlecode.com/svn/trunk/docs/_build/html/index.html#mozrunner.Profile"><tt class="xref docutils literal"><span class="pre">mozrunner.Profile</span></tt></a> and <a title="(in mozrunner v2.0a1)" class="reference external" href="http://mozrunner.googlecode.com/svn/trunk/docs/_build/html/index.html#mozrunner.Runner"><tt class="xref docutils literal"><span class="pre">mozrunner.Runner</span></tt></a> are still
-<a title="(in mozrunner v2.0a1)" class="reference external" href="http://mozrunner.googlecode.com/svn/trunk/docs/_build/html/index.html#mozrunner.FirefoxProfile"><tt class="xref docutils literal"><span class="pre">mozrunner.FirefoxProfile</span></tt></a> and <a title="(in mozrunner v2.0a1)" class="reference external" href="http://mozrunner.googlecode.com/svn/trunk/docs/_build/html/index.html#mozrunner.FirefoxRunner"><tt class="xref docutils literal"><span class="pre">mozrunner.FirefoxRunner</span></tt></a>. You can
-change this by creating your own command line utility by subclassing <a title="mozmill.CLI" class="reference internal" href="#mozmill.CLI"><tt class="xref docutils literal"><span class="pre">CLI</span></tt></a></p>
-</dd></dl>
-
-<dl class="cmdoption">
-<dt id="cmdoption-d">
-<tt class="descname">-d</tt><tt class="descclassname"> <defaultprofile></tt><a class="headerlink" href="#cmdoption-d" title="Permalink to this definition">¶</a></dt>
-<dd>Specify the path to the default <strong>clean</strong> profile used to create new profiles.</dd></dl>
-
-<dl class="cmdoption">
-<dt id="cmdoption-n">
-<tt class="descname">-n</tt><tt class="descclassname"></tt><tt class="descclassname">, </tt><tt class="descname">--no-new-profile</tt><tt class="descclassname"></tt><a class="headerlink" href="#cmdoption-n" title="Permalink to this definition">¶</a></dt>
-<dd>Do not create a new fresh profile.</dd></dl>
-
-<dl class="cmdoption">
-<dt id="cmdoption-p">
-<tt class="descname">-p</tt><tt class="descclassname"> <profile></tt><tt class="descclassname">, </tt><tt class="descname">--profile</tt><tt class="descclassname"> <profile></tt><a class="headerlink" href="#cmdoption-p" title="Permalink to this definition">¶</a></dt>
-<dd>Specifies a profile to use. Must be used with –no-new-profile.</dd></dl>
-
-<dl class="cmdoption">
-<dt id="cmdoption-w">
-<tt class="descname">-w</tt><tt class="descclassname"> <plugins></tt><tt class="descclassname">, </tt><tt class="descname">--plugins</tt><tt class="descclassname"> <plugins></tt><a class="headerlink" href="#cmdoption-w" title="Permalink to this definition">¶</a></dt>
-<dd><p>Comma seperated list of additional paths to plugins to install.</p>
-<p>Plugins can be either .xpi zip compressed extensions or deflated extension directories.</p>
-</dd></dl>
-
-<dl class="cmdoption">
-<dt id="cmdoption-l">
-<tt class="descname">-l</tt><tt class="descclassname"> <logfile></tt><tt class="descclassname">, </tt><tt class="descname">--logfile</tt><tt class="descclassname"> <logfile></tt><a class="headerlink" href="#cmdoption-l" title="Permalink to this definition">¶</a></dt>
-<dd>Log all events to <em>logfile</em>.</dd></dl>
-
-<dl class="cmdoption">
-<dt id="cmdoption--report">
-<tt class="descname">--report</tt><tt class="descclassname"> <uri></tt><a class="headerlink" href="#cmdoption--report" title="Permalink to this definition">¶</a></dt>
-<dd><p><em>Currently in development.</em></p>
-<p>POST results to given brasstacks results server at <em>uri</em>.</p>
-</dd></dl>
-
-<dl class="cmdoption">
-<dt id="cmdoption-t">
-<tt class="descname">-t</tt><tt class="descclassname"> <test></tt><tt class="descclassname">, </tt><tt class="descname">--test</tt><tt class="descclassname"> <test></tt><a class="headerlink" href="#cmdoption-t" title="Permalink to this definition">¶</a></dt>
-<dd>Run <em>test</em>. Can be either single test file or directory of tests.</dd></dl>
-
-<dl class="cmdoption">
-<dt id="cmdoption--showall">
-<tt class="descname">--showall</tt><tt class="descclassname"></tt><a class="headerlink" href="#cmdoption--showall" title="Permalink to this definition">¶</a></dt>
-<dd>Show all test output.</dd></dl>
-
-<dl class="cmdoption">
-<dt id="cmdoption-D">
-<tt class="descname">-D</tt><tt class="descclassname"></tt><tt class="descclassname">, </tt><tt class="descname">--debug</tt><tt class="descclassname"></tt><a class="headerlink" href="#cmdoption-D" title="Permalink to this definition">¶</a></dt>
-<dd>Install debugging extensions and run with -jsconole</dd></dl>
-
-<dl class="cmdoption">
-<dt id="cmdoption--show-errors">
-<tt class="descname">--show-errors</tt><tt class="descclassname"></tt><a class="headerlink" href="#cmdoption--show-errors" title="Permalink to this definition">¶</a></dt>
-<dd>Print all logger errors to the console. When running tests only test failures and skipped
-tests are printed, this option print all other errors.</dd></dl>
-
-<dl class="cmdoption">
-<dt id="cmdoption-s">
-<tt class="descname">-s</tt><tt class="descclassname"></tt><tt class="descclassname">, </tt><tt class="descname">--shell</tt><tt class="descclassname"></tt><a class="headerlink" href="#cmdoption-s" title="Permalink to this definition">¶</a></dt>
-<dd>Starts a Python shell for debugging.</dd></dl>
-
-<dl class="cmdoption">
-<dt id="cmdoption-u">
-<tt class="descname">-u</tt><tt class="descclassname"></tt><tt class="descclassname">, </tt><tt class="descname">--usecode</tt><tt class="descclassname"></tt><a class="headerlink" href="#cmdoption-u" title="Permalink to this definition">¶</a></dt>
-<dd>By default –shell mode will use iPython if install and fall back to using the code module.
-This option forces the use of the code module instead of iPython even when installed.</dd></dl>
-
-<dl class="cmdoption">
-<dt id="cmdoption-P">
-<tt class="descname">-P</tt><tt class="descclassname"> <port></tt><tt class="descclassname">, </tt><tt class="descname">--port</tt><tt class="descclassname"> <port></tt><a class="headerlink" href="#cmdoption-P" title="Permalink to this definition">¶</a></dt>
-<dd>Specify port for jsbridge.</dd></dl>
-
-</div>
-<div class="section" id="command-line-class">
-<h2>Command Line Class<a class="headerlink" href="#command-line-class" title="Permalink to this headline">¶</a></h2>
-<dl class="class">
-<dt id="mozmill.CLI">
-<!--[mozmill.CLI]-->class <tt class="descclassname">mozmill.</tt><tt class="descname">CLI</tt><a class="headerlink" href="#mozmill.CLI" title="Permalink to this definition">¶</a></dt>
-<dd><p>Inherits from <a title="(in jsbridge v2.0a1)" class="reference external" href="http://jsbridge.googlecode.com/svn/trunk/docs/_build/html/index.html#jsbridge.CLI"><tt class="xref docutils literal"><span class="pre">jsbridge.CLI</span></tt></a> which inherits from <a title="(in mozrunner v2.0a1)" class="reference external" href="http://mozrunner.googlecode.com/svn/trunk/docs/_build/html/index.html#mozrunner.CLI"><tt class="xref docutils literal"><span class="pre">mozrunner.CLI</span></tt></a>.</p>
-<p>All the heavy lifting is handled by jsbridge and mozrunner. If you are subclassing
-this in order to creat a new command line interface be sure to call <a title="(in Python v2.7)" class="reference external" href="http://docs.python.org/dev/library/functions.html#super"><tt class="xref docutils literal"><span class="pre">super()</span></tt></a> on all
-related methods.</p>
-<dl class="attribute">
-<dt id="mozmill.CLI.runner_class">
-<!--[mozmill.CLI.runner_class]--><tt class="descname">runner_class</tt><a class="headerlink" href="#mozmill.CLI.runner_class" title="Permalink to this definition">¶</a></dt>
-<dd>Default runner class. Should be subclass of <a title="(in mozrunner v2.0a1)" class="reference external" href="http://mozrunner.googlecode.com/svn/trunk/docs/_build/html/index.html#mozrunner.Runner"><tt class="xref docutils literal"><span class="pre">mozrunner.Runner</span></tt></a>.
-Defaults to <a title="(in mozrunner v2.0a1)" class="reference external" href="http://mozrunner.googlecode.com/svn/trunk/docs/_build/html/index.html#mozrunner.FirefoxRunner"><tt class="xref docutils literal"><span class="pre">mozrunner.FirefoxRunner</span></tt></a>.</dd></dl>
-
-<dl class="attribute">
-<dt id="mozmill.CLI.profile_class">
-<!--[mozmill.CLI.profile_class]--><tt class="descname">profile_class</tt><a class="headerlink" href="#mozmill.CLI.profile_class" title="Permalink to this definition">¶</a></dt>
-<dd>Default profile class. Should be subclass of <tt class="xref docutils literal"><span class="pre">mozruner.Profile</span></tt>.
-Defaults to <a title="(in mozrunner v2.0a1)" class="reference external" href="http://mozrunner.googlecode.com/svn/trunk/docs/_build/html/index.html#mozrunner.FirefoxProfile"><tt class="xref docutils literal"><span class="pre">mozrunner.FirefoxProfile</span></tt></a>.</dd></dl>
-
-</dd></dl>
-
-</div>
-<div class="section" id="running-mozmill-from-python">
-<h2>Running MozMill from Python<a class="headerlink" href="#running-mozmill-from-python" title="Permalink to this headline">¶</a></h2>
-<dl class="class">
-<dt id="mozmill.MozMill">
-<!--[mozmill.MozMill]-->class <tt class="descclassname">mozmill.</tt><tt class="descname">MozMill</tt><big>(</big><span class="optional">[</span><em>runner_class</em><span class="optional">[</span>, <em>profile_class</em><span class="optional">[</span>, <em>jsbridge_port</em><span class="optional">]</span><span class="optional">]</span><span class="optional">]</span><big>)</big><a class="headerlink" href="#mozmill.MozMill" title="Permalink to this definition">¶</a></dt>
-<dd><p>Manages an instance of Firefox w/ jsbridge and provides facilities for running tests and
-keeping track of results with callback methods.</p>
-<p>Default <em>runner_class</em> is <a title="(in mozrunner v2.0a1)" class="reference external" href="http://mozrunner.googlecode.com/svn/trunk/docs/_build/html/index.html#mozrunner.FirefoxRunner"><tt class="xref docutils literal"><span class="pre">mozrunner.FirefoxRunner</span></tt></a>. Value should be a subclass of
-<a title="(in mozrunner v2.0a1)" class="reference external" href="http://mozrunner.googlecode.com/svn/trunk/docs/_build/html/index.html#mozrunner.Runner"><tt class="xref docutils literal"><span class="pre">mozrunner.Runner</span></tt></a>.</p>
-<p>Default <em>profile_class</em> is <a title="(in mozrunner v2.0a1)" class="reference external" href="http://mozrunner.googlecode.com/svn/trunk/docs/_build/html/index.html#mozrunner.FirefoxProfile"><tt class="xref docutils literal"><span class="pre">mozrunner.FirefoxProfile</span></tt></a>. Value should be a subclass of
-<a title="(in mozrunner v2.0a1)" class="reference external" href="http://mozrunner.googlecode.com/svn/trunk/docs/_build/html/index.html#mozrunner.Profile"><tt class="xref docutils literal"><span class="pre">mozrunner.Profile</span></tt></a>.</p>
-<p>Default <em>jsbridge_port</em> is <cite>24242</cite>.</p>
-<dl class="attribute">
-<dt id="mozmill.MozMill.runner_class">
-<!--[mozmill.MozMill.runner_class]--><tt class="descname">runner_class</tt><a class="headerlink" href="#mozmill.MozMill.runner_class" title="Permalink to this definition">¶</a></dt>
-<dd>Set during initialization to subclass of <a title="(in mozrunner v2.0a1)" class="reference external" href="http://mozrunner.googlecode.com/svn/trunk/docs/_build/html/index.html#mozrunner.Runner"><tt class="xref docutils literal"><span class="pre">mozrunner.Runner</span></tt></a>.</dd></dl>
-
-<dl class="attribute">
-<dt id="mozmill.MozMill.profile_class">
-<!--[mozmill.MozMill.profile_class]--><tt class="descname">profile_class</tt><a class="headerlink" href="#mozmill.MozMill.profile_class" title="Permalink to this definition">¶</a></dt>
-<dd>Set during initialization to subclass of <a title="(in mozrunner v2.0a1)" class="reference external" href="http://mozrunner.googlecode.com/svn/trunk/docs/_build/html/index.html#mozrunner.Profile"><tt class="xref docutils literal"><span class="pre">mozrunner.Profile</span></tt></a>.</dd></dl>
-
-<dl class="attribute">
-<dt id="mozmill.MozMill.jsbridge_port">
-<!--[mozmill.MozMill.jsbridge_port]--><tt class="descname">jsbridge_port</tt><a class="headerlink" href="#mozmill.MozMill.jsbridge_port" title="Permalink to this definition">¶</a></dt>
-<dd>Set during initialization to <a title="(in Python v2.7)" class="reference external" href="http://docs.python.org/dev/library/numbers.html#numbers.Integral"><tt class="xref docutils literal"><span class="pre">numbers.Integral</span></tt></a>.</dd></dl>
-
-<dl class="method">
-<dt id="mozmill.MozMill.start">
-<!--[mozmill.MozMill.start]--><tt class="descname">start</tt><big>(</big><span class="optional">[</span><em>profile</em><span class="optional">[</span>, <em>runner</em><span class="optional">]</span><span class="optional">]</span><big>)</big><a class="headerlink" href="#mozmill.MozMill.start" title="Permalink to this definition">¶</a></dt>
-<dd><p>Start mozrunner and jsbridge pre-requisites.</p>
-<p><em>profile</em> should be an instance of a <cite>mozrunner.Profile</cite> subclass. If one is not passed
-an instance of <cite>self.profile_class</cite> is created. <cite>self.profile</cite> will be set to this
-value.</p>
-<p><em>runner</em> should be an instance of a <cite>mozrunner.Runner</cite> subclass. If one is not passed an
-instance of <a title="mozmill.MozMill.runner_class" class="reference internal" href="#mozmill.MozMill.runner_class"><tt class="xref docutils literal"><span class="pre">runner_class</span></tt></a> will be created. <a title="mozmill.MozMill.runner" class="reference internal" href="#mozmill.MozMill.runner"><tt class="xref docutils literal"><span class="pre">runner</span></tt></a> will be set to this value.</p>
-<p>This method will also run <cite>runner.start()</cite> and <tt class="xref docutils literal"><span class="pre">mozrunner.wait_and_create_network()</span></tt>
-and sets <a title="mozmill.MozMill.back_channel" class="reference internal" href="#mozmill.MozMill.back_channel"><tt class="xref docutils literal"><span class="pre">back_channel</span></tt></a> and <a title="mozmill.MozMill.bridge" class="reference internal" href="#mozmill.MozMill.bridge"><tt class="xref docutils literal"><span class="pre">bridge</span></tt></a> to instances of
-<a title="(in jsbridge v2.0a1)" class="reference external" href="http://jsbridge.googlecode.com/svn/trunk/docs/_build/html/index.html#jsbridge.BackChannel"><tt class="xref docutils literal"><span class="pre">jsbridge.BackChannel</span></tt></a> and <a title="(in jsbridge v2.0a1)" class="reference external" href="http://jsbridge.googlecode.com/svn/trunk/docs/_build/html/index.html#jsbridge.Bridge"><tt class="xref docutils literal"><span class="pre">jsbridge.Bridge</span></tt></a> respectively.</p>
-</dd></dl>
-
-<dl class="attribute">
-<dt id="mozmill.MozMill.profile">
-<!--[mozmill.MozMill.profile]--><tt class="descname">profile</tt><a class="headerlink" href="#mozmill.MozMill.profile" title="Permalink to this definition">¶</a></dt>
-<dd>Set during <a title="mozmill.MozMill.start" class="reference internal" href="#mozmill.MozMill.start"><tt class="xref docutils literal"><span class="pre">start()</span></tt></a> to subclass of <a title="(in mozrunner v2.0a1)" class="reference external" href="http://mozrunner.googlecode.com/svn/trunk/docs/_build/html/index.html#mozrunner.Profile"><tt class="xref docutils literal"><span class="pre">mozrunner.Profile</span></tt></a>.</dd></dl>
-
-<dl class="attribute">
-<dt id="mozmill.MozMill.runner">
-<!--[mozmill.MozMill.runner]--><tt class="descname">runner</tt><a class="headerlink" href="#mozmill.MozMill.runner" title="Permalink to this definition">¶</a></dt>
-<dd>Set during <a title="mozmill.MozMill.start" class="reference internal" href="#mozmill.MozMill.start"><tt class="xref docutils literal"><span class="pre">start()</span></tt></a> to subclass of <a title="(in mozrunner v2.0a1)" class="reference external" href="http://mozrunner.googlecode.com/svn/trunk/docs/_build/html/index.html#mozrunner.Runner"><tt class="xref docutils literal"><span class="pre">mozrunner.Runner</span></tt></a>.</dd></dl>
-
-<dl class="attribute">
-<dt id="mozmill.MozMill.back_channel">
-<!--[mozmill.MozMill.back_channel]--><tt class="descname">back_channel</tt><a class="headerlink" href="#mozmill.MozMill.back_channel" title="Permalink to this definition">¶</a></dt>
-<dd>Set during <a title="mozmill.MozMill.start" class="reference internal" href="#mozmill.MozMill.start"><tt class="xref docutils literal"><span class="pre">start()</span></tt></a> to subclass of <a title="(in jsbridge v2.0a1)" class="reference external" href="http://jsbridge.googlecode.com/svn/trunk/docs/_build/html/index.html#jsbridge.BackChannel"><tt class="xref docutils literal"><span class="pre">jsbridge.BackChannel</span></tt></a>.</dd></dl>
-
-<dl class="attribute">
-<dt id="mozmill.MozMill.bridge">
-<!--[mozmill.MozMill.bridge]--><tt class="descname">bridge</tt><a class="headerlink" href="#mozmill.MozMill.bridge" title="Permalink to this definition">¶</a></dt>
-<dd>Set during <a title="mozmill.MozMill.start" class="reference internal" href="#mozmill.MozMill.start"><tt class="xref docutils literal"><span class="pre">start()</span></tt></a> to subclass of <a title="(in jsbridge v2.0a1)" class="reference external" href="http://jsbridge.googlecode.com/svn/trunk/docs/_build/html/index.html#jsbridge.Bridge"><tt class="xref docutils literal"><span class="pre">jsbridge.Bridge</span></tt></a></dd></dl>
-
-<dl class="method">
-<dt id="mozmill.MozMill.run_tests">
-<!--[mozmill.MozMill.run_tests]--><tt class="descname">run_tests</tt><big>(</big><em>test</em><span class="optional">[</span>, <em>report</em><span class="optional">]</span><big>)</big><a class="headerlink" href="#mozmill.MozMill.run_tests" title="Permalink to this definition">¶</a></dt>
-<dd><p>Run <em>test</em> in live Firefox using <a title="mozmill.MozMill.bridge" class="reference internal" href="#mozmill.MozMill.bridge"><tt class="xref docutils literal"><span class="pre">bridge</span></tt></a>.</p>
-<p>Adds local listeners <a title="mozmill.MozMill.endTest_listener" class="reference internal" href="#mozmill.MozMill.endTest_listener"><tt class="xref docutils literal"><span class="pre">endTest_listener()</span></tt></a> and <a title="mozmill.MozMill.endRunner_listener" class="reference internal" href="#mozmill.MozMill.endRunner_listener"><tt class="xref docutils literal"><span class="pre">endRunner_listener()</span></tt></a> to
-<cite>“endTest”</cite> and <cite>“endRunner”</cite> events using <a title="(in jsbridge v2.0a1)" class="reference external" href="http://jsbridge.googlecode.com/svn/trunk/docs/_build/html/index.html#jsbridge.BackChannel.add_listener"><tt class="xref docutils literal"><span class="pre">jsbridge.BackChannel.add_listener()</span></tt></a> of
-<a title="mozmill.MozMill.back_channel" class="reference internal" href="#mozmill.MozMill.back_channel"><tt class="xref docutils literal"><span class="pre">back_channel</span></tt></a>.</p>
-<p>When tests are done the results are posted to a results server at <em>report</em> if passed.</p>
-</dd></dl>
-
-<dl class="method">
-<dt id="mozmill.MozMill.endTest_listener">
-<!--[mozmill.MozMill.endTest_listener]--><tt class="descname">endTest_listener</tt><big>(</big><em>test</em><big>)</big><a class="headerlink" href="#mozmill.MozMill.endTest_listener" title="Permalink to this definition">¶</a></dt>
-<dd>When a test is finished the test object will be passed to this callback.</dd></dl>
-
-<dl class="method">
-<dt id="mozmill.MozMill.endRunner_listener">
-<!--[mozmill.MozMill.endRunner_listener]--><tt class="descname">endRunner_listener</tt><big>(</big><em>obj</em><big>)</big><a class="headerlink" href="#mozmill.MozMill.endRunner_listener" title="Permalink to this definition">¶</a></dt>
-<dd>When all the tests are done running this callback will be fired.</dd></dl>
-
-</dd></dl>
-
-</div>
-</div>
-
-
- </div>
- </div>
- </div>
- <div class="sphinxsidebar">
- <div class="sphinxsidebarwrapper">
- <h3><a href="">Table Of Contents</a></h3>
- <ul>
-<li><a class="reference external" href=""><tt class="docutils literal"><span class="pre">mozmill</span></tt> — Full automation of XULRunner applications.</a><ul>
-<li><a class="reference external" href="#command-line-usage">Command Line Usage</a></li>
-<li><a class="reference external" href="#command-line-class">Command Line Class</a></li>
-<li><a class="reference external" href="#running-mozmill-from-python">Running MozMill from Python</a></li>
-</ul>
-</li>
-</ul>
-
- <h3>This Page</h3>
- <ul class="this-page-menu">
- <li><a href="_sources/index.txt">Show Source</a></li>
- </ul>
- <h3>Quick search</h3>
- <form class="search" action="search.html" method="get">
- <input type="text" name="q" size="18" /> <input type="submit" value="Go" />
- <input type="hidden" name="check_keywords" value="yes" />
- <input type="hidden" name="area" value="default" />
- </form>
- </div>
- </div>
- <div class="clearer"></div>
- </div>
- <div class="related">
- <h3>Navigation</h3>
- <ul>
- <li class="right" style="margin-right: 10px">
- <a href="genindex.html" title="General Index"
- accesskey="I">index</a></li>
- <li class="right" >
- <a href="modindex.html" title="Global Module Index"
- accesskey="M">modules</a> |</li>
- <li><a href="">mozmill v1.2.1a1 documentation</a> »</li>
- </ul>
- </div>
- <div class="footer">
- © Copyright 2009, Mikeal Rogers <mikeal.rogers@gmail.com>.
- Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.5.1.
- </div>
- </body>
-</html>
\ No newline at end of file
deleted file mode 100644
--- a/mail/test/resources/mozmill/docs/_build/html/modindex.html
+++ /dev/null
@@ -1,97 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-
- <title>Global Module Index — mozmill v1.2.1a1 documentation</title>
- <link rel="stylesheet" href="_static/default.css" type="text/css" />
- <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
- <script type="text/javascript">
- var DOCUMENTATION_OPTIONS = {
- URL_ROOT: '',
- VERSION: '1.2.1a1',
- COLLAPSE_MODINDEX: false,
- FILE_SUFFIX: '.html',
- HAS_SOURCE: true
- };
- </script>
- <script type="text/javascript" src="_static/jquery.js"></script>
- <script type="text/javascript" src="_static/doctools.js"></script>
- <link rel="index" title="Index" href="genindex.html" />
- <link rel="search" title="Search" href="search.html" />
- <link rel="top" title="mozmill v1.2.1a1 documentation" href="index.html" />
-
-
- <script type="text/javascript">
- DOCUMENTATION_OPTIONS.COLLAPSE_MODINDEX = true;
- </script>
-
-
- </head>
- <body>
- <div class="related">
- <h3>Navigation</h3>
- <ul>
- <li class="right" style="margin-right: 10px">
- <a href="genindex.html" title="General Index"
- accesskey="I">index</a></li>
- <li class="right" >
- <a href="" title="Global Module Index"
- accesskey="M">modules</a> |</li>
- <li><a href="index.html">mozmill v1.2.1a1 documentation</a> »</li>
- </ul>
- </div>
- <div class="document">
- <div class="documentwrapper">
- <div class="bodywrapper">
- <div class="body">
-
-
- <h1 id="global-module-index">Global Module Index</h1>
-
-
- <a href="#cap-M"><strong>M</strong></a>
- <hr/>
-
- <table width="100%" class="indextable" cellspacing="0" cellpadding="2"><tr class="pcap"><td></td><td> </td><td></td></tr>
- <tr class="cap"><td></td><td><a name="cap-M"><strong>M</strong></a></td><td></td></tr><tr>
- <td></td>
- <td>
- <a href="index.html#module-mozmill"><tt class="xref">mozmill</tt></a></td><td>
- <em>Full automation of XULRunner applications.</em></td></tr>
- </table>
-
-
- </div>
- </div>
- </div>
- <div class="sphinxsidebar">
- <div class="sphinxsidebarwrapper">
- <h3>Quick search</h3>
- <form class="search" action="search.html" method="get">
- <input type="text" name="q" size="18" /> <input type="submit" value="Go" />
- <input type="hidden" name="check_keywords" value="yes" />
- <input type="hidden" name="area" value="default" />
- </form>
- </div>
- </div>
- <div class="clearer"></div>
- </div>
- <div class="related">
- <h3>Navigation</h3>
- <ul>
- <li class="right" style="margin-right: 10px">
- <a href="genindex.html" title="General Index"
- accesskey="I">index</a></li>
- <li class="right" >
- <a href="" title="Global Module Index"
- accesskey="M">modules</a> |</li>
- <li><a href="index.html">mozmill v1.2.1a1 documentation</a> »</li>
- </ul>
- </div>
- <div class="footer">
- © Copyright 2009, Mikeal Rogers <mikeal.rogers@gmail.com>.
- Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.5.1.
- </div>
- </body>
-</html>
\ No newline at end of file
deleted file mode 100644
--- a/mail/test/resources/mozmill/docs/_build/html/objects.inv
+++ /dev/null
@@ -1,19 +0,0 @@
-# Sphinx inventory version 1
-# Project: mozmill
-# Version: 1.2.1a1
-mozmill mod index.html
-mozmill.MozMill.start method index.html
-mozmill.CLI class index.html
-mozmill.MozMill class index.html
-mozmill.MozMill.endTest_listener method index.html
-mozmill.MozMill.runner_class attribute index.html
-mozmill.MozMill.back_channel attribute index.html
-mozmill.CLI.profile_class attribute index.html
-mozmill.MozMill.jsbridge_port attribute index.html
-mozmill.MozMill.profile_class attribute index.html
-mozmill.CLI.runner_class attribute index.html
-mozmill.MozMill.profile attribute index.html
-mozmill.MozMill.bridge attribute index.html
-mozmill.MozMill.endRunner_listener method index.html
-mozmill.MozMill.runner attribute index.html
-mozmill.MozMill.run_tests method index.html
deleted file mode 100644
--- a/mail/test/resources/mozmill/docs/_build/html/search.html
+++ /dev/null
@@ -1,89 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-
- <title>Search — mozmill v1.2.1a1 documentation</title>
- <link rel="stylesheet" href="_static/default.css" type="text/css" />
- <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
- <script type="text/javascript">
- var DOCUMENTATION_OPTIONS = {
- URL_ROOT: '',
- VERSION: '1.2.1a1',
- COLLAPSE_MODINDEX: false,
- FILE_SUFFIX: '.html',
- HAS_SOURCE: true
- };
- </script>
- <script type="text/javascript" src="_static/jquery.js"></script>
- <script type="text/javascript" src="_static/doctools.js"></script>
- <script type="text/javascript" src="_static/searchtools.js"></script>
- <link rel="index" title="Index" href="genindex.html" />
- <link rel="search" title="Search" href="" />
- <link rel="top" title="mozmill v1.2.1a1 documentation" href="index.html" />
- </head>
- <body>
- <div class="related">
- <h3>Navigation</h3>
- <ul>
- <li class="right" style="margin-right: 10px">
- <a href="genindex.html" title="General Index"
- accesskey="I">index</a></li>
- <li class="right" >
- <a href="modindex.html" title="Global Module Index"
- accesskey="M">modules</a> |</li>
- <li><a href="index.html">mozmill v1.2.1a1 documentation</a> »</li>
- </ul>
- </div>
- <div class="document">
- <div class="documentwrapper">
- <div class="bodywrapper">
- <div class="body">
-
- <h1 id="search-documentation">Search</h1>
- <p>
- From here you can search these documents. Enter your search
- words into the box below and click "search". Note that the search
- function will automatically search for all of the words. Pages
- containing fewer words won't appear in the result list.
- </p>
- <form action="" method="get">
- <input type="text" name="q" value="" />
- <input type="submit" value="search" />
- <span id="search-progress" style="padding-left: 10px"></span>
- </form>
-
- <div id="search-results">
-
- </div>
-
- </div>
- </div>
- </div>
- <div class="sphinxsidebar">
- <div class="sphinxsidebarwrapper">
- </div>
- </div>
- <div class="clearer"></div>
- </div>
- <div class="related">
- <h3>Navigation</h3>
- <ul>
- <li class="right" style="margin-right: 10px">
- <a href="genindex.html" title="General Index"
- accesskey="I">index</a></li>
- <li class="right" >
- <a href="modindex.html" title="Global Module Index"
- accesskey="M">modules</a> |</li>
- <li><a href="index.html">mozmill v1.2.1a1 documentation</a> »</li>
- </ul>
- </div>
-
- <div class="footer">
- © Copyright 2009, Mikeal Rogers <mikeal.rogers@gmail.com>.
- Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.5.1.
- </div>
- <script type="text/javascript" src="searchindex.js"></script>
-
- </body>
-</html>
\ No newline at end of file
deleted file mode 100644
--- a/mail/test/resources/mozmill/docs/_build/html/searchindex.js
+++ /dev/null
@@ -1,1 +0,0 @@
-Search.setIndex({desctypes:{"0":"method","1":"class","2":"attribute"},terms:{all:0,code:0,help:0,show:0,skip:0,fall:0,tcp:[],jsbridge_port:0,mozmil:0,endrunn:0,comma:0,jsbridg:0,still:0,find:0,jsconol:0,current:0,onli:0,locat:0,cli:0,binari:0,should:0,add:0,logger:0,local:0,sure:0,applic:0,firefoxrunn:0,python:0,initi:0,autom:0,util:0,failur:0,report:0,run_test:0,requir:[],docutil:0,list:0,server:0,provid:0,either:0,debug:0,output:0,side:0,"int":[],set:0,fair:0,seper:0,back:0,defaultprofil:0,mozrun:0,result:0,mozrunn:0,pass:0,event:0,out:0,even:0,xulrunn:0,back_channel:0,subclass:0,profil:0,exit:0,print:0,"new":0,method:0,attribut:[],shut:0,full:0,run:0,usag:0,given:0,extens:0,ipython:0,path:0,post:0,"super":0,valu:0,addit:0,deflat:0,obj:0,brasstack:0,plugin:0,forc:0,manag:0,amount:0,instanc:0,chang:0,own:0,firefox:0,modul:0,number:0,down:0,done:0,instal:0,facil:0,your:0,xpi:0,span:0,log:0,zip:0,messag:0,usecod:0,avail:0,start:0,live:0,interfac:0,includ:0,handl:0,call:0,default_profil:[],type:[],listen:0,wait_and_create_network:0,from:0,shell:0,consol:0,option:0,fire:0,relat:0,specifi:0,ani:0,lift:0,line:0,must:0,heavi:0,"default":0,endtest:0,directori:0,bridg:0,can:0,error:0,pre:0,firefoxprofil:0,add_listen:0,creat:0,ctrl:0,runner:0,dure:0,argument:0,mode:0,showal:0,liter:0,versatil:0,file:0,requisit:0,keep:0,integr:0,develop:0,self:0,when:0,backchannel:0,port:0,also:0,other:0,"__init__":[],which:0,test:0,instead:0,you:0,endrunner_listen:0,singl:0,finish:0,clean:0,though:0,track:0,object:0,compress:0,endtest_listen:0,most:0,logfil:0,profile_class:0,"class":0,url:[],runner_class:0,well:0,uri:0,inherit:0,callback:0,without:0,command:0,thi:0,fresh:0,order:0,respect:0},titles:["<tt class=\"docutils literal\"><span class=\"pre\">mozmill</span></tt> — Full automation of XULRunner applications."],modules:{mozmill:0},descrefs:{"mozmill.CLI":{runner_class:[0,2],profile_class:[0,2]},"mozmill.MozMill":{profile:[0,2],bridge:[0,2],endRunner_listener:[0,0],endTest_listener:[0,0],jsbridge_port:[0,2],runner:[0,2],back_channel:[0,2],runner_class:[0,2],run_tests:[0,0],start:[0,0],profile_class:[0,2]},mozmill:{CLI:[0,1],MozMill:[0,1]}},filenames:["index"]})
\ No newline at end of file
deleted file mode 100644
--- a/mail/test/resources/mozmill/docs/conf.py
+++ /dev/null
@@ -1,194 +0,0 @@
-# -*- coding: utf-8 -*-
-#
-# mozmill documentation build configuration file, created by
-# sphinx-quickstart on Mon Mar 16 14:30:49 2009.
-#
-# This file is execfile()d with the current directory set to its containing dir.
-#
-# The contents of this file are pickled, so don't put values in the namespace
-# that aren't pickleable (module imports are okay, they're removed automatically).
-#
-# Note that not all possible configuration values are present in this
-# autogenerated file.
-#
-# All configuration values have a default; values that are commented out
-# serve to show the default.
-
-import sys, os
-
-# If your extensions are in another directory, add it here. If the directory
-# is relative to the documentation root, use os.path.abspath to make it
-# absolute, like shown here.
-#sys.path.append(os.path.abspath('.'))
-
-# General configuration
-# ---------------------
-
-# Add any Sphinx extension module names here, as strings. They can be extensions
-# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
-extensions = ["sphinx.ext.intersphinx"]
-
-intersphinx_mapping = {'http://docs.python.org/dev': None,
- 'http://mozrunner.googlecode.com/svn/trunk/docs/_build/html/': None,
- 'http://jsbridge.googlecode.com/svn/trunk/docs/_build/html/': None}
-
-# Add any paths that contain templates here, relative to this directory.
-templates_path = ['_templates']
-
-# The suffix of source filenames.
-source_suffix = '.rst'
-
-# The encoding of source files.
-#source_encoding = 'utf-8'
-
-# The master toctree document.
-master_doc = 'index'
-
-# General information about the project.
-project = u'mozmill'
-copyright = u'2009, Mikeal Rogers <mikeal.rogers@gmail.com>'
-
-# The version info for the project you're documenting, acts as replacement for
-# |version| and |release|, also used in various other places throughout the
-# built documents.
-#
-# The short X.Y version.
-version = '1.2.1a1'
-# The full version, including alpha/beta/rc tags.
-release = '1.2.1a1'
-
-# The language for content autogenerated by Sphinx. Refer to documentation
-# for a list of supported languages.
-#language = None
-
-# There are two options for replacing |today|: either, you set today to some
-# non-false value, then it is used:
-#today = ''
-# Else, today_fmt is used as the format for a strftime call.
-#today_fmt = '%B %d, %Y'
-
-# List of documents that shouldn't be included in the build.
-#unused_docs = []
-
-# List of directories, relative to source directory, that shouldn't be searched
-# for source files.
-exclude_trees = ['_build']
-
-# The reST default role (used for this markup: `text`) to use for all documents.
-#default_role = None
-
-# If true, '()' will be appended to :func: etc. cross-reference text.
-#add_function_parentheses = True
-
-# If true, the current module name will be prepended to all description
-# unit titles (such as .. function::).
-#add_module_names = True
-
-# If true, sectionauthor and moduleauthor directives will be shown in the
-# output. They are ignored by default.
-#show_authors = False
-
-# The name of the Pygments (syntax highlighting) style to use.
-pygments_style = 'sphinx'
-
-
-# Options for HTML output
-# -----------------------
-
-# The style sheet to use for HTML and HTML Help pages. A file of that name
-# must exist either in Sphinx' static/ path, or in one of the custom paths
-# given in html_static_path.
-html_style = 'default.css'
-
-# The name for this set of Sphinx documents. If None, it defaults to
-# "<project> v<release> documentation".
-#html_title = None
-
-# A shorter title for the navigation bar. Default is the same as html_title.
-#html_short_title = None
-
-# The name of an image file (relative to this directory) to place at the top
-# of the sidebar.
-#html_logo = None
-
-# The name of an image file (within the static path) to use as favicon of the
-# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
-# pixels large.
-#html_favicon = None
-
-# Add any paths that contain custom static files (such as style sheets) here,
-# relative to this directory. They are copied after the builtin static files,
-# so a file named "default.css" will overwrite the builtin "default.css".
-html_static_path = ['_static']
-
-# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
-# using the given strftime format.
-#html_last_updated_fmt = '%b %d, %Y'
-
-# If true, SmartyPants will be used to convert quotes and dashes to
-# typographically correct entities.
-#html_use_smartypants = True
-
-# Custom sidebar templates, maps document names to template names.
-#html_sidebars = {}
-
-# Additional templates that should be rendered to pages, maps page names to
-# template names.
-#html_additional_pages = {}
-
-# If false, no module index is generated.
-#html_use_modindex = True
-
-# If false, no index is generated.
-#html_use_index = True
-
-# If true, the index is split into individual pages for each letter.
-#html_split_index = False
-
-# If true, the reST sources are included in the HTML build as _sources/<name>.
-#html_copy_source = True
-
-# If true, an OpenSearch description file will be output, and all pages will
-# contain a <link> tag referring to it. The value of this option must be the
-# base URL from which the finished HTML is served.
-#html_use_opensearch = ''
-
-# If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml").
-#html_file_suffix = ''
-
-# Output file base name for HTML help builder.
-htmlhelp_basename = 'mozmilldoc'
-
-
-# Options for LaTeX output
-# ------------------------
-
-# The paper size ('letter' or 'a4').
-#latex_paper_size = 'letter'
-
-# The font size ('10pt', '11pt' or '12pt').
-#latex_font_size = '10pt'
-
-# Grouping the document tree into LaTeX files. List of tuples
-# (source start file, target name, title, author, document class [howto/manual]).
-latex_documents = [
- ('index', 'mozmill.tex', ur'mozmill Documentation',
- ur'Mikeal Rogers <mikeal.rogers@gmail.com>', 'manual'),
-]
-
-# The name of an image file (relative to this directory) to place at the top of
-# the title page.
-#latex_logo = None
-
-# For "manual" documents, if this is true, then toplevel headings are parts,
-# not chapters.
-#latex_use_parts = False
-
-# Additional stuff for the LaTeX preamble.
-#latex_preamble = ''
-
-# Documents to append as an appendix to all manuals.
-#latex_appendices = []
-
-# If false, no module index is generated.
-#latex_use_modindex = True
deleted file mode 100644
--- a/mail/test/resources/mozmill/docs/index.rst
+++ /dev/null
@@ -1,188 +0,0 @@
-:mod:`mozmill` --- Full automation of XULRunner applications.
-=============================================================
-
-.. module:: mozmill
- :synopsis: Full automation of XULRunner applications.
-.. moduleauthor:: Mikeal Rogers <mikeal.rogers@gmail.com>
-.. sectionauthor:: Mikeal Rogers <mikeal.rogers@gmail.com>
-
-Command Line Usage
-------------------
-
-The mozmill command line is versatile and includes a fair amount of debugging options. Even though all these options are available mozmill should run by default without any arguments and find your locally installed Firefox and run with mozmill.
-
-In most modes, ctrl-c will shut down Firefox and exit out of the mozmill Python side as well.
-
-.. code-block:: none
-
- $ mozmill
-
-.. cmdoption:: -h, --help
-
- Show help message.
-
-.. cmdoption:: -b <binary>, --binary <binary>
-
- Specify application binary location.
-
- Default :class:`mozrunner.Profile` and :class:`mozrunner.Runner` are still
- :class:`mozrunner.FirefoxProfile` and :class:`mozrunner.FirefoxRunner`. You can
- change this by creating your own command line utility by subclassing :class:`CLI`
-
-.. cmdoption:: -d <defaultprofile>
-
- Specify the path to the default **clean** profile used to create new profiles.
-
-.. cmdoption:: -n, --no-new-profile
-
- Do not create a new fresh profile.
-
-.. cmdoption:: -p <profile>, --profile <profile>
-
- Specifies a profile to use. Must be used with --no-new-profile.
-
-.. cmdoption:: -w <plugins>, --plugins <plugins>
-
- Comma seperated list of additional paths to plugins to install.
-
- Plugins can be either .xpi zip compressed extensions or deflated extension directories.
-
-.. cmdoption:: -l <logfile>, --logfile <logfile>
-
- Log all events to *logfile*.
-
-.. cmdoption:: --report <uri>
-
- *Currently in development.*
-
- POST results to given brasstacks results server at *uri*.
-
-.. cmdoption:: -t <test>, --test <test>
-
- Run *test*. Can be either single test file or directory of tests.
-
-.. cmdoption:: --showall
-
- Show all test output.
-
-.. cmdoption:: -D, --debug
-
- Install debugging extensions and run with -jsconole
-
-.. cmdoption:: --show-errors
-
- Print all logger errors to the console. When running tests only test failures and skipped
- tests are printed, this option print all other errors.
-
-.. cmdoption:: -s, --shell
-
- Starts a Python shell for debugging.
-
-.. cmdoption:: -u, --usecode
-
- By default --shell mode will use iPython if install and fall back to using the code module.
- This option forces the use of the code module instead of iPython even when installed.
-
-.. cmdoption:: -P <port>, --port <port>
-
- Specify port for jsbridge.
-
-Command Line Class
-------------------
-
-.. class:: CLI
-
- Inherits from :class:`jsbridge.CLI` which inherits from :class:`mozrunner.CLI`.
-
- All the heavy lifting is handled by jsbridge and mozrunner. If you are subclassing
- this in order to creat a new command line interface be sure to call :func:`super` on all
- related methods.
-
- .. attribute:: runner_class
-
- Default runner class. Should be subclass of :class:`mozrunner.Runner`.
- Defaults to :class:`mozrunner.FirefoxRunner`.
-
- .. attribute:: profile_class
-
- Default profile class. Should be subclass of :class:`mozruner.Profile`.
- Defaults to :class:`mozrunner.FirefoxProfile`.
-
-Running MozMill from Python
----------------------------
-
-.. class:: MozMill([runner_class[, profile_class[, jsbridge_port]]])
-
- Manages an instance of Firefox w/ jsbridge and provides facilities for running tests and
- keeping track of results with callback methods.
-
- Default *runner_class* is :class:`mozrunner.FirefoxRunner`. Value should be a subclass of
- :class:`mozrunner.Runner`.
-
- Default *profile_class* is :class:`mozrunner.FirefoxProfile`. Value should be a subclass of
- :class:`mozrunner.Profile`.
-
- Default *jsbridge_port* is `24242`.
-
- .. attribute:: runner_class
-
- Set during initialization to subclass of :class:`mozrunner.Runner`.
-
- .. attribute:: profile_class
-
- Set during initialization to subclass of :class:`mozrunner.Profile`.
-
- .. attribute:: jsbridge_port
-
- Set during initialization to :class:`numbers.Integral`.
-
- .. method:: start([profile[, runner]])
-
- Start mozrunner and jsbridge pre-requisites.
-
- *profile* should be an instance of a `mozrunner.Profile` subclass. If one is not passed
- an instance of `self.profile_class` is created. `self.profile` will be set to this
- value.
-
- *runner* should be an instance of a `mozrunner.Runner` subclass. If one is not passed an
- instance of :attr:`runner_class` will be created. :attr:`runner` will be set to this value.
-
- This method will also run `runner.start()` and :func:`mozrunner.wait_and_create_network`
- and sets :attr:`back_channel` and :attr:`bridge` to instances of
- :class:`jsbridge.BackChannel` and :class:`jsbridge.Bridge` respectively.
-
- .. attribute:: profile
-
- Set during :meth:`start` to subclass of :class:`mozrunner.Profile`.
-
- .. attribute:: runner
-
- Set during :meth:`start` to subclass of :class:`mozrunner.Runner`.
-
- .. attribute:: back_channel
-
- Set during :meth:`start` to subclass of :class:`jsbridge.BackChannel`.
-
- .. attribute:: bridge
-
- Set during :meth:`start` to subclass of :class:`jsbridge.Bridge`
-
- .. method:: run_tests(test[, report])
-
- Run *test* in live Firefox using :attr:`bridge`.
-
- Adds local listeners :meth:`endTest_listener` and :meth:`endRunner_listener` to
- `"endTest"` and `"endRunner"` events using :meth:`jsbridge.BackChannel.add_listener` of
- :attr:`back_channel`.
-
- When tests are done the results are posted to a results server at *report* if passed.
-
- .. method:: endTest_listener(test)
-
- When a test is finished the test object will be passed to this callback.
-
- .. method:: endRunner_listener(obj)
-
- When all the tests are done running this callback will be fired.
-
-
\ No newline at end of file
deleted file mode 100644
--- a/mail/test/resources/mozmill/mozmill/__init__.py
+++ /dev/null
@@ -1,845 +0,0 @@
-# ***** BEGIN LICENSE BLOCK *****
-# Version: MPL 1.1/GPL 2.0/LGPL 2.1
-#
-# The contents of this file are subject to the Mozilla Public License Version
-# 1.1 (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-# http://www.mozilla.org/MPL/
-#
-# Software distributed under the License is distributed on an "AS IS" basis,
-# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-# for the specific language governing rights and limitations under the
-# License.
-#
-# The Original Code is Mozilla Corporation Code.
-#
-# The Initial Developer of the Original Code is
-# Mikeal Rogers.
-# Portions created by the Initial Developer are Copyright (C) 2008
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-# Mikeal Rogers <mikeal.rogers@gmail.com>
-# Henrik Skupin <hskupin@mozilla.com>
-# Clint Talbert <ctalbert@mozilla.com>
-#
-# Alternatively, the contents of this file may be used under the terms of
-# either the GNU General Public License Version 2 or later (the "GPL"), or
-# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-# in which case the provisions of the GPL or the LGPL are applicable instead
-# of those above. If you wish to allow use of your version of this file only
-# under the terms of either the GPL or the LGPL, and not to allow others to
-# use your version of this file under the terms of the MPL, indicate your
-# decision by deleting the provisions above and replace them with the notice
-# and other provisions required by the GPL or the LGPL. If you do not delete
-# the provisions above, a recipient may use your version of this file under
-# the terms of any one of the MPL, the GPL or the LGPL.
-#
-# ***** END LICENSE BLOCK *****
-
-import copy
-import httplib
-import imp
-import os
-import socket
-import sys
-import traceback
-import urllib
-import urlparse
-
-from datetime import datetime, timedelta
-import manifestparser
-
-try:
- import json
-except:
- import simplejson as json
-
-# setup logger
-import logging
-logger = logging.getLogger('mozmill')
-
-import jsbridge
-from jsbridge.network import JSBridgeDisconnectError
-import mozrunner
-
-from time import sleep
-
-basedir = os.path.abspath(os.path.dirname(__file__))
-
-extension_path = os.path.join(basedir, 'extension')
-
-mozmillModuleJs = "Components.utils.import('resource://mozmill/modules/mozmill.js')"
-
-class LoggerListener(object):
- cases = {
- 'mozmill.pass': lambda string: logger.info('Step Pass: ' + string),
- 'mozmill.fail': lambda string: logger.error('Test Failure: ' + string),
- 'mozmill.skip': lambda string: logger.info('Test Skipped: ' + string)
- }
-
- class default(object):
- def __init__(self, eName): self.eName = eName
- def __call__(self, string):
- if string:
- logger.debug(self.eName + ' | ' + string)
- else:
- logger.debug(self.eName)
-
- def __call__(self, eName, obj):
- if obj == {}:
- string = ''
- else:
- string = json.dumps(obj)
-
- if eName not in self.cases:
- self.cases[eName] = self.default(eName)
- self.cases[eName](string)
-
-
-class TestsFailedException(Exception):
- """exception to be raised when the tests fail"""
- # XXX unused
-
-
-class MozMill(object):
- """
- MozMill is a one-shot test runner You should use MozMill as follows:
-
- m = MozMill(...)
- m.start(...)
- m.run_tests()
- m.stop()
-
- You should *NOT* vary from this order of execution. If you have need to
- run different sets of tests, create a new instantiation of MozMill
- """
-
- report_type = 'mozmill-test'
-
- def __init__(self,
- runner_class=mozrunner.FirefoxRunner,
- profile_class=mozrunner.FirefoxProfile,
- jsbridge_port=24242,
- jsbridge_timeout=60):
- """
- - runner_class : which mozrunner class to use
- - profile_class : which class to use to generate application profiles
- - jsbridge_port : port jsbridge uses to connect to to the application
- - jsbridge_timeout : how long to go without jsbridge communication
- """
-
- self.runner_class = runner_class
- self.profile_class = profile_class
- self.jsbridge_port = jsbridge_port
- self.jsbridge_timeout = jsbridge_timeout
-
- self.passes = [] ; self.fails = [] ; self.skipped = []
- self.alltests = []
-
- self.persisted = {}
- self.endRunnerCalled = False
- self.shutdownModes = enum('default', 'user_shutdown', 'user_restart')
- self.currentShutdownMode = self.shutdownModes.default
- self.userShutdownEnabled = False
- self.tests = []
-
- # test time
- self.starttime = self.endtime = None
-
- # setup event listeners
- self.global_listeners = []
- self.listeners = []
- self.add_listener(self.persist_listener, eventType="mozmill.persist")
- self.add_listener(self.endTest_listener, eventType='mozmill.endTest')
- self.add_listener(self.endRunner_listener, eventType='mozmill.endRunner')
- self.add_listener(self.startTest_listener, eventType='mozmill.setTest')
- self.add_listener(self.userShutdown_listener, eventType='mozmill.userShutdown')
-
- # disable the crashreporter
- os.environ['MOZ_CRASHREPORTER_NO_REPORT'] = '1'
-
- def add_listener(self, callback, **kwargs):
- self.listeners.append((callback, kwargs,))
-
- def add_global_listener(self, callback):
- self.global_listeners.append(callback)
-
- def persist_listener(self, obj):
- self.persisted = obj
-
- def fire_python_callback(self, method, arg, python_callbacks_module):
- meth = getattr(python_callbacks_module, method)
- try:
- meth(arg)
- except Exception, e:
- self.endTest_listener({"name":method, "failed":1,
- "python_exception_type":e.__class__.__name__,
- "python_exception_string":str(e),
- "python_traceback":traceback.format_exc(),
- "filename":python_callbacks_module.__file__})
- return False
- self.endTest_listener({"name":method, "failed":0,
- "filename":python_callbacks_module.__file__})
- return True
-
- def firePythonCallback_listener(self, obj):
- callback_file = "%s_callbacks.py" % os.path.splitext(obj['filename'])[0]
- if os.path.isfile(callback_file):
- python_callbacks_module = imp.load_source('callbacks', callback_file)
- else:
- raise Exception("No valid callback file")
- self.fire_python_callback(obj['method'], obj['arg'], python_callbacks_module)
-
- def create_network(self):
-
- # get the bridge and the back-channel
- self.back_channel, self.bridge = jsbridge.wait_and_create_network("127.0.0.1",
- self.jsbridge_port)
-
- # set a timeout on jsbridge actions in order to ensure termination
- self.back_channel.timeout = self.bridge.timeout = self.jsbridge_timeout
-
- # Assign listeners to the back channel
- for listener in self.listeners:
- self.back_channel.add_listener(listener[0], **listener[1])
- for global_listener in self.global_listeners:
- self.back_channel.add_global_listener(global_listener)
-
- def start(self, profile=None, runner=None):
-
- if not profile:
- profile = self.profile_class(addons=[jsbridge.extension_path, extension_path])
- self.profile = profile
-
- if not runner:
- runner = self.runner_class(profile=self.profile,
- cmdargs=["-jsbridge", str(self.jsbridge_port)])
-
- self.add_listener(self.firePythonCallback_listener, eventType='mozmill.firePythonCallback')
- self.runner = runner
- self.endRunnerCalled = False
-
- self.runner.start()
- self.create_network()
- self.appinfo = self.get_appinfo(self.bridge)
-
- # set the starttime for the tests
- # XXX assumes run_tests will be called soon after (currently true)
- self.starttime = datetime.utcnow()
-
- def find_tests(self, tests, files=None):
- if files is None:
- files = []
- for test in tests:
-
- # tests have to be absolute paths to be loaded from JS
- test = os.path.abspath(test)
-
- if os.path.isdir(test):
- directory = test
- for f in os.listdir(directory):
- if not f.startswith('test'):
- continue
- path = os.path.join(directory, f)
- if os.path.isdir(path):
- self.find_tests([path], files)
- else:
- if f.endswith('.js') and path not in files:
- files.append(path)
- else:
- files.append(test)
- return files
-
-
- def run_tests(self, tests, sleeptime=0):
- """
- run test files or directories
- - test : test files or directories to run
- - sleeptime : initial time to sleep [s] (not sure why the default is 4)
- """
-
- tests = self.find_tests(tests)
- self.tests.extend(tests)
-
- frame = jsbridge.JSObject(self.bridge,
- "Components.utils.import('resource://mozmill/modules/frame.js')")
- sleep(sleeptime)
-
- # transfer persisted data
- frame.persisted = self.persisted
-
- # run the test files
- for test in tests:
- frame.runTestFile(test)
-
- # Give a second for any callbacks to finish.
- sleep(1)
-
- def startTest_listener(self, test):
- self.current_test = test
- print "TEST-START | %s | %s" % (test['filename'], test['name'])
-
- def endTest_listener(self, test):
- self.alltests.append(test)
- if test.get('skipped', False):
- print "WARNING | %s | (SKIP) %s" % (test['name'], test.get('skipped_reason', ''))
- self.skipped.append(test)
- elif test['failed'] > 0:
- print "TEST-UNEXPECTED-FAIL | %s | %s" % (test['filename'], test['name'])
- self.fails.append(test)
- else:
- print "TEST-PASS | %s | %s" % (test['filename'], test['name'])
- self.passes.append(test)
-
- def endRunner_listener(self, obj):
- self.endRunnerCalled = True
-
- def userShutdown_listener(self, obj):
- if obj in [self.shutdownModes.default, self.shutdownModes.user_restart, self.shutdownModes.user_shutdown]:
- self.currentShutdownMode = obj
- self.userShutdownEnabled = not self.userShutdownEnabled
-
- ### methods for reporting
-
- def printStats(self):
- """print pass/failed/skipped statistics"""
- print "INFO Passed: %d" % len(self.passes)
- print "INFO Failed: %d" % len(self.fails)
- print "INFO Skipped: %d" % len(self.skipped)
-
- def report_disconnect(self):
- test = self.current_test
- test['passes'] = []
- test['fails'] = [{
- 'exception' : {
- 'message': 'Disconnect Error: Application unexpectedly closed'
- }
- }]
- test['passed'] = 0
- test['failed'] = 1
- self.alltests.append(test)
- self.fails.append(test)
-
- def get_appinfo(self, bridge):
- """ Collect application specific information """
-
- mozmill = jsbridge.JSObject(bridge, mozmillModuleJs)
- appInfo = mozmill.appInfo
-
- results = {'application_id': str(appInfo.ID),
- 'application_name': str(appInfo.name),
- 'application_version': str(appInfo.version),
- 'application_locale': str(mozmill.locale),
- 'platform_buildid': str(appInfo.platformBuildID),
- 'platform_version': str(appInfo.platformVersion),
- }
-
- return results
-
- def get_platform_information(self):
- """ Retrieves platform information for test reports. Parts of that code
- come from the dirtyharry application:
- http://github.com/harthur/dirtyharry/blob/master/dirtyutils.py """
-
- import platform
- import re
-
- (system, node, release, version, machine, processor) = platform.uname()
- (bits, linkage) = platform.architecture()
- service_pack = ''
-
- if system in ["Microsoft", "Windows"]:
- # There is a Python bug on Windows to determine platform values
- # http://bugs.python.org/issue7860
- if "PROCESSOR_ARCHITEW6432" in os.environ:
- processor = os.environ.get("PROCESSOR_ARCHITEW6432", processor)
- else:
- processor = os.environ.get('PROCESSOR_ARCHITECTURE', processor)
- system = os.environ.get("OS", system).replace('_', ' ')
- service_pack = os.sys.getwindowsversion()[4]
- elif system == "Linux":
- (distro, version, codename) = platform.dist()
- version = distro + " " + version
- if not processor:
- processor = machine
- elif system == "Darwin":
- system = "Mac"
- (release, versioninfo, machine) = platform.mac_ver()
- version = "OS X " + release
-
- if processor in ["i386", "i686"]:
- if bits == "32bit":
- processor = "x86"
- elif bits == "64bit":
- processor = "x86_64"
- elif processor == "AMD64":
- bits = "64bit"
- processor = "x86_64"
- elif processor == "Power Macintosh":
- processor = "ppc"
-
- bits = re.search('(\d+)bit', bits).group(1)
-
- platform = {'hostname': node,
- 'system': system,
- 'version': version,
- 'service_pack': service_pack,
- 'processor': processor,
- 'bits': bits
- }
-
- return platform
-
- def get_report(self):
- """get the report results"""
- format = "%Y-%m-%dT%H:%M:%SZ"
-
- assert self.tests, 'no tests have been run!'
- assert self.starttime, 'starttime not set; have you started the tests?'
- if not self.endtime:
- self.endtime = datetime.utcnow()
-
- report = {'report_type': self.report_type,
- 'time_start': self.starttime.strftime(format),
- 'time_end': self.endtime.strftime(format),
- 'time_upload': 'n/a',
- 'tests_passed': len(self.passes),
- 'tests_failed': len(self.fails),
- 'tests_skipped': len(self.skipped),
- 'results': self.alltests
- }
-
- report.update(self.appinfo)
- report.update(self.runner.get_repositoryInfo())
- report['system_info'] = self.get_platform_information()
-
- return report
-
- def send_report(self, results, report_url):
- """ Send a report of the results to a CouchdB instance or a file. """
-
- # report to file or stdout
- f = None
- if report_url == 'stdout': # stdout
- f = sys.stdout
- if report_url.startswith('file://'):
- filename = report_url.split('file://', 1)[1]
- try:
- f = file(filename, 'w')
- except Exception, e:
- print "Printing results to '%s' failed (%s)." % (filename, e)
- return
- if f:
- print >> f, json.dumps(results)
- return
-
- # report to CouchDB
- try:
- # Set the upload time of the report
- now = datetime.utcnow()
- results['time_upload'] = now.strftime("%Y-%m-%dT%H:%M:%SZ")
-
- # Parse URL fragments and send data
- url_fragments = urlparse.urlparse(report_url)
- connection = httplib.HTTPConnection(url_fragments.netloc)
- connection.request("POST", url_fragments.path, json.dumps(results),
- {"Content-type": "application/json"})
-
- # Get response which contains the id of the new document
- response = connection.getresponse()
- data = json.loads(response.read())
- connection.close()
-
- # Check if the report has been created
- if not data['ok']:
- print "Creating report document failed (%s)" % data
- return data
-
- # Print document location to the console and return
- print "Report document created at '%s%s'" % (report_url, data['id'])
- return data
- except Exception, e:
- print "Sending results to '%s' failed (%s)." % (report_url, e)
-
- def report(self, report_url):
- """print statistics and send the JSON report"""
- self.printStats()
-
- if report_url:
- results = self.get_report()
- return self.send_report(results, report_url)
-
- ### methods for shutting down and cleanup
-
- def stop_runner(self, timeout=30, close_bridge=False, hard=False):
- sleep(1)
- try:
- mozmill = jsbridge.JSObject(self.bridge, mozmillModuleJs)
- mozmill.cleanQuit()
- except (socket.error, JSBridgeDisconnectError):
- pass
- except:
- self.runner.cleanup()
- raise
-
- if not close_bridge:
- starttime = datetime.utcnow()
- self.runner.wait(timeout=timeout)
- endtime = datetime.utcnow()
- if ( endtime - starttime ) > timedelta(seconds=timeout):
- try:
- self.runner.stop()
- except:
- pass
- self.runner.wait()
- else: # TODO: unify this logic with the above better
- if hard:
- self.runner.cleanup()
- return
-
- # XXX this call won't actually finish in the specified timeout time
- self.runner.wait(timeout=timeout)
-
- self.back_channel.close()
- self.bridge.close()
- x = 0
- while x < timeout:
- if self.endRunnerCalled:
- break
- sleep(1)
- x += 1
- else:
- print "WARNING | endRunner was never called. There must have been a failure in the framework."
- self.runner.cleanup()
- sys.exit(1)
-
- def stop(self, fatal=False):
- """cleanup"""
-
- # stop the runner
- self.stop_runner(timeout=10, close_bridge=True, hard=fatal)
-
- # cleanup the profile if you need to
- if self.runner is not None:
- self.runner.cleanup()
-
-
-class MozMillRestart(MozMill):
-
- report_type = 'mozmill-restart-test'
-
- def __init__(self, *args, **kwargs):
- MozMill.__init__(self, *args, **kwargs)
- self.python_callbacks = []
-
- def add_listener(self, callback, **kwargs):
- self.listeners.append((callback, kwargs,))
-
- def add_global_listener(self, callback):
- self.global_listeners.append(callback)
-
- def start(self, runner=None, profile=None):
-
- if not profile:
- profile = self.profile_class(addons=[jsbridge.extension_path, extension_path])
- self.profile = profile
-
- if not runner:
- runner = self.runner_class(profile=self.profile,
- cmdargs=["-jsbridge", str(self.jsbridge_port)])
- self.runner = runner
- self.endRunnerCalled = False
- self.add_listener(self.firePythonCallback_listener, eventType='mozmill.firePythonCallback')
-
- # set the starttime for the tests
- # XXX assumes run_tests will be called soon after (currently true)
- self.starttime = datetime.utcnow()
-
- def firePythonCallback_listener(self, obj):
- if obj['fire_now']:
- self.fire_python_callback(obj['method'], obj['arg'], self.python_callbacks_module)
- else:
- self.python_callbacks.append(obj)
-
- def start_runner(self):
-
- # if user_restart we don't need to start the browser back up
- if self.currentShutdownMode != self.shutdownModes.user_restart:
- self.runner.start()
-
- self.create_network()
- self.appinfo = self.get_appinfo(self.bridge)
- frame = jsbridge.JSObject(self.bridge,
- "Components.utils.import('resource://mozmill/modules/frame.js')")
- return frame
-
- def run_dir(self, test_dir, sleeptime=0):
- """run a directory of restart tests resetting the profile per directory"""
-
- # TODO: document this behaviour!
- if os.path.isfile(os.path.join(test_dir, 'testPre.js')):
- pre_test = os.path.join(test_dir, 'testPre.js')
- post_test = os.path.join(test_dir, 'testPost.js')
- if not os.path.exists(pre_test) or not os.path.exists(post_test):
- print "Skipping "+test_dir+" does not contain both pre and post test."
- return
-
- tests = [pre_test, post_test]
- else:
- if not os.path.isfile(os.path.join(test_dir, 'test1.js')):
- print "Skipping "+test_dir+" does not contain any known test file names"
- return
- tests = []
- counter = 1
- while os.path.isfile(os.path.join(test_dir, "test"+str(counter)+".js")):
- tests.append(os.path.join(test_dir, "test"+str(counter)+".js"))
- counter += 1
-
- self.add_listener(self.endRunner_listener, eventType='mozmill.endRunner')
-
- if os.path.isfile(os.path.join(test_dir, 'callbacks.py')):
- self.python_callbacks_module = imp.load_source('callbacks', os.path.join(test_dir, 'callbacks.py'))
-
- for test in tests:
- frame = self.start_runner()
- self.currentShutdownMode = self.shutdownModes.default
- self.endRunnerCalled = False
- sleep(sleeptime)
-
- frame.persisted = self.persisted
- try:
- frame.runTestFile(test)
- while not self.endRunnerCalled:
- sleep(.25)
- self.currentShutdownMode = self.shutdownModes.default
- self.stop_runner()
- sleep(2) # Give mozrunner some time to shutdown the browser
- except JSBridgeDisconnectError:
- if not self.userShutdownEnabled:
- raise JSBridgeDisconnectError()
- self.userShutdownEnabled = False
-
- for callback in self.python_callbacks:
- self.fire_python_callback(callback['method'], callback['arg'], self.python_callbacks_module)
- self.python_callbacks = []
-
- self.python_callbacks_module = None
-
- # Reset the profile.
- profile = self.runner.profile
- profile.cleanup()
- if profile.create_new:
- profile.profile = profile.create_new_profile(self.runner.binary)
- for addon in profile.addons:
- profile.install_addon(addon)
- if jsbridge.extension_path not in profile.addons:
- profile.install_addon(jsbridge.extension_path)
- if extension_path not in profile.addons:
- profile.install_addon(extension_path)
- profile.set_preferences(profile.preferences)
-
- def find_tests(self, tests):
- files = []
-
- # make sure these are all directories
- not_dir = [ i for i in tests
- if not os.path.isdir(i) ]
- if not_dir:
- raise IOError('Restart tests must be directories (%s)' % ', '.join(not_dir))
-
- for test_dir in tests:
-
- # tests have to be absolute paths, for some reason
- test_dir = os.path.abspath(test_dir)
-
- # XXX this allows for only one sub-level of test directories
- # is this a spec or a side-effect?
- # If the former, it should be documented
- test_dirs = [os.path.join(test_dir, d)
- for d in os.listdir(test_dir)
- if d.startswith('test') and os.path.isdir(os.path.join(test_dir, d))]
-
- if len(test_dirs):
- files.extend(test_dirs)
- else:
- files.append(test_dir)
-
- return files
-
- def run_tests(self, tests, sleeptime=0):
-
- test_dirs = self.find_tests(tests)
- self.tests.extend(test_dirs)
-
- for test_dir in test_dirs:
- self.run_dir(test_dir, sleeptime)
-
- # cleanup the profile
- self.runner.cleanup()
-
- # Give a second for any pending callbacks to finish
- sleep(1)
-
- def stop(self, fatal=False):
- """MozmillRestart doesn't need to do cleanup as this is already done per directory"""
-
- # XXX this is a one-off to fix bug 581733
- # really, the entire shutdown sequence should be reconsidered and
- # made more robust.
- # See https://bugzilla.mozilla.org/show_bug.cgi?id=581733#c20
- # This will *NOT* work with all edge cases and it shouldn't be
- # expected that adding on more kills() for each edge case will ever
- # be able to fix a systematic issue by patching holes
- if fatal:
- self.runner.cleanup()
-
-
-class CLI(jsbridge.CLI):
- mozmill_class = MozMill
- module = "mozmill"
-
- parser_options = copy.copy(jsbridge.CLI.parser_options)
- parser_options[("-t", "--test",)] = dict(dest="test", action='append', default=[],
- help="Run test")
- parser_options[("-l", "--logfile",)] = dict(dest="logfile", default=None,
- help="Log all events to file.")
- parser_options[("--show-errors",)] = dict(dest="showerrors", default=False,
- action="store_true",
- help="Print logger errors to the console.")
- parser_options[("--report",)] = dict(dest="report", default=False,
- help="Report the results. Requires url to results server. Use 'stdout' for stdout.")
- parser_options[("--show-all",)] = dict(dest="showall", default=False, action="store_true",
- help="Show all test output.")
- parser_options[("--timeout",)] = dict(dest="timeout", type="float",
- default=60.,
- help="seconds before harness timeout if no communication is taking place")
- parser_options[("-m", "--manifest")] = dict(dest='manifests', action='append',
- help='test manifest .ini file')
- parser_options[("--app-arg",)] = dict(dest='appArgs', action='append', default=[],
- help='provides an argument to the test application')
-
- def __init__(self, *args, **kwargs):
- jsbridge.CLI.__init__(self, *args, **kwargs)
- self.mozmill = self.mozmill_class(runner_class=mozrunner.FirefoxRunner,
- profile_class=mozrunner.FirefoxProfile,
- jsbridge_port=int(self.options.port),
- jsbridge_timeout=self.options.timeout,
- )
-
- self.tests = []
-
- # read tests from manifests
- if self.options.manifests:
- manifest_parser = manifestparser.TestManifest(manifests=self.options.manifests)
-
- self.tests.extend(manifest_parser.test_paths())
-
- # expand user directory for individual tests
- for test in self.options.test:
- test = os.path.expanduser(test)
- self.tests.append(test)
-
- # check existence for the tests
- missing = [ test for test in self.tests
- if not os.path.exists(test) ]
- if missing:
- raise IOError("Not a valid test file/directory: %s" % ', '.join(["'%s'" % test for test in missing]))
-
-
- # setup log formatting
- self.mozmill.add_global_listener(LoggerListener())
- log_options = { 'format': "%(levelname)s | %(message)s",
- 'level': logging.CRITICAL }
- if self.options.showerrors:
- log_options['level'] = logging.ERROR
- if self.options.logfile:
- log_options['filename'] = self.options.logfile
- log_options['filemode'] = 'w'
- log_options['level'] = logging.DEBUG
- if self.options.test and self.options.showall:
- log_options['level'] = logging.DEBUG
- logging.basicConfig(**log_options)
-
- def get_profile(self, *args, **kwargs):
- profile = jsbridge.CLI.get_profile(self, *args, **kwargs)
- profile.install_addon(extension_path)
- return profile
-
- def run(self):
-
- # create a Mozrunner
- runner = self.create_runner()
-
- runner.cmdargs.extend(self.options.appArgs)
-
- # make sure the application starts in the foreground
- if '-foreground' not in runner.cmdargs:
- runner.cmdargs.append('-foreground')
-
- try:
- self.mozmill.start(runner=runner, profile=runner.profile)
- except:
- runner.cleanup()
- raise
-
- if self.tests:
-
- # run the tests
- disconnected = False
- try:
- self.mozmill.run_tests(self.tests)
- except JSBridgeDisconnectError:
- disconnected = True
- if not self.mozmill.userShutdownEnabled:
- self.mozmill.report_disconnect()
- print 'TEST-UNEXPECTED-FAIL | Disconnect Error: Application unexpectedly closed'
- runner.cleanup()
- except:
- runner.cleanup()
- raise
-
- # shutdown the test harness
- self.mozmill.stop(fatal=disconnected)
-
- # print statistics and send the JSON report
- self.mozmill.report(self.options.report)
-
- if self.mozmill.fails or disconnected:
- sys.exit(1)
- else:
- if self.options.shell:
- self.start_shell(runner)
- else:
- try:
- if not hasattr(runner, 'process_handler'):
- runner.start()
- runner.wait()
- except KeyboardInterrupt:
- runner.stop()
-
- if self.mozmill.runner is not None:
- self.mozmill.runner.cleanup()
-
-
-class RestartCLI(CLI):
- mozmill_class = MozMillRestart
-
-
-class ThunderbirdCLI(CLI):
- profile_class = mozrunner.ThunderbirdProfile
- runner_class = mozrunner.ThunderbirdRunner
-
-
-def enum(*sequential, **named):
- enums = dict(zip(sequential, range(len(sequential))), **named)
- return type('Enum', (), enums)
-
-def cli():
- CLI().run()
-
-def tbird_cli():
- ThunderbirdCLI().run()
-
-def restart_cli():
- RestartCLI().run()
deleted file mode 100644
--- a/mail/test/resources/mozmill/mozmill/extension/build.xml
+++ /dev/null
@@ -1,60 +0,0 @@
-<?xml version="1.0"?>
-
-<!--
-build.xml adapted from Shawn Wilsher's rtse
-(http://shawnwilsher.com/extensions/rtse/)
- -->
-
-<project name="mozmill" default="createxpi">
- <tstamp>
- <format property="build.number" pattern="yyyyMMdd" offset="-1" unit="hour"/>
- </tstamp>
- <property name="build.version" value="1.1.${build.number}"/>
-
- <target name="createxpi" depends="createjar">
- <delete file="mozmill.xpi"/>
- <zip destfile="mozmill.xpi">
- <zipfileset dir="" includes="chrome/mozmill.jar"/>
- <zipfileset dir="" includes="chrome/mozmill-locale.jar"/>
- <zipfileset dir="" includes="chrome/mozmill-skin.jar"/>
- <zipfileset dir="" includes="install.rdf"/>
- <zipfileset dir="" includes="readme.txt"/>
- <zipfileset dir="" includes="chrome-jar.manifest" fullpath="chrome.manifest"/>
- <zipfileset dir="" includes="defaults/**" excludes="**SVN"/>
- <zipfileset dir="" includes="resource/**" excludes="**SVN"/>
- </zip>
- <antcall target="cleanup"/>
- </target>
-
- <target name="createjar">
- <mkdir dir="chrome"/>
- <zip destfile="chrome/mozmill.jar">
- <zipfileset dir="" includes="content/**" excludes="**SVN"/>
- </zip>
- <zip destfile="chrome/mozmill-locale.jar">
- <zipfileset dir="" includes="locale/**" excludes="**SVN"/>
- </zip>
- <zip destfile="chrome/mozmill-skin.jar">
- <zipfileset dir="" includes="skin/**" excludes="**SVN"/>
- </zip>
- </target>
-
- <target name="unpacked">
- <delete file="mozmill.xpi"/>
- <zip destfile="mozmill.xpi">
- <zipfileset dir="" includes="content/**" excludes="**SVN"/>
- <zipfileset dir="" includes="locale/**" excludes="**SVN"/>
- <zipfileset dir="" includes="skin/**" excludes="**SVN"/>
- <zipfileset dir="" includes="install.rdf"/>
- <zipfileset dir="" includes="readme.txt"/>
- <zipfileset dir="" includes="chrome.manifest" fullpath="chrome.manifest"/>
- <zipfileset dir="" includes="defaults/**" excludes="**SVN"/>
- <zipfileset dir="" includes="resource/**" excludes="**SVN"/>
- </zip>
- </target>
-
- <target name="cleanup">
- <!-- Delete the chrome directory, any other cleanup actions go here -->
- <delete dir="chrome"/>
- </target>
-</project>
deleted file mode 100644
--- a/mail/test/resources/mozmill/mozmill/extension/chrome-jar.manifest
+++ /dev/null
@@ -1,12 +0,0 @@
-resource mozmill resource/
-content mozmill jar:chrome/mozmill.jar!/content/
-locale mozmill en-US jar:chrome/mozmill-locale.jar!/locale/en-US/
-skin mozmill classic/1.0 jar:chrome/mozmill-skin.jar!/skin/
-
-overlay chrome://browser/content/browser.xul chrome://mozmill/content/overlay.xul
-overlay chrome://messenger/content/mailWindowOverlay.xul chrome://mozmill/content/overlay_tb.xul
-overlay chrome://calendar/content/calendar.xul chrome://mozmill/content/overlay.xul
-overlay chrome://navigator/content/navigatorOverlay.xul chrome://mozmill/content/overlay_tb.xul
-overlay windowtype:Songbird:Main chrome://mozmill/content/overlay.xul
-
-style chrome://global/content/customizeToolbar.xul chrome://mozmill/skin/overlay.css
deleted file mode 100644
--- a/mail/test/resources/mozmill/mozmill/extension/chrome.manifest
+++ /dev/null
@@ -1,15 +0,0 @@
-resource mozmill resource/
-
-content mozmill content/
-overlay chrome://browser/content/browser.xul chrome://mozmill/content/overlay.xul
-overlay chrome://messenger/content/mailWindowOverlay.xul chrome://mozmill/content/overlay_tb.xul
-overlay chrome://calendar/content/calendar.xul chrome://mozmill/content/overlay.xul
-overlay chrome://sunbird/content/calendar.xul chrome://mozmill/content/overlay.xul
-overlay chrome://navigator/content/navigatorOverlay.xul chrome://mozmill/content/overlay_tb.xul
-
-overlay windowtype:Songbird:Main chrome://mozmill/content/overlay.xul
-
-locale mozmill en-US locale/en-US/
-
-skin mozmill classic/1.0 skin/
-style chrome://global/content/customizeToolbar.xul chrome://mozmill/skin/overlay.css
deleted file mode 100644
--- a/mail/test/resources/mozmill/mozmill/extension/content/chrome.js
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Adds tooltip support to the Mozmill window. Taken from browser.js in Firefox */
-function fillTooltip(tipElement) {
- var retVal = false;
- if (tipElement.namespaceURI == "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul")
- return retVal;
- const XLinkNS = "http://www.w3.org/1999/xlink";
- var titleText = null;
- var XLinkTitleText = null;
- var direction = tipElement.ownerDocument.dir;
-
- while (!titleText && !XLinkTitleText && tipElement) {
- if (tipElement.nodeType == Node.ELEMENT_NODE) {
- titleText = tipElement.getAttribute("title");
- XLinkTitleText = tipElement.getAttributeNS(XLinkNS, "title");
- var defView = tipElement.ownerDocument.defaultView;
- // Work around bug 350679: "Tooltips can be fired in documents with no view"
- if (!defView)
- return retVal;
- direction = defView.getComputedStyle(tipElement, "")
- .getPropertyValue("direction");
- }
- tipElement = tipElement.parentNode;
- }
-
- var tipNode = document.getElementById("mozmill-tooltip");
- tipNode.style.direction = direction;
-
- for each (var t in [titleText, XLinkTitleText]) {
- if (t && /\S/.test(t)) {
- // Per HTML 4.01 6.2 (CDATA section), literal CRs and tabs should be
- // replaced with spaces, and LFs should be removed entirely
- t = t.replace(/[\r\t]/g, ' ');
- t = t.replace(/\n/g, '');
-
- tipNode.setAttribute("label", t);
- retVal = true;
- }
- }
- return retVal;
-}
deleted file mode 100644
--- a/mail/test/resources/mozmill/mozmill/extension/content/css/fg.menu.css
+++ /dev/null
@@ -1,114 +0,0 @@
-/* Styles for jQuery menu widget
-Author: Maggie Wachs, maggie@filamentgroup.com
-Date: September 2008
-*/
-
-
-/* REQUIRED STYLES - the menus will only render correctly with these rules */
-
-.fg-menu-container { position: absolute; top:0; left:-999px; padding: .4em; overflow: hidden; }
-.fg-menu-container.fg-menu-flyout { overflow: visible; }
-
-.fg-menu, .fg-menu ul { list-style-type:none; padding: 0; margin:0; }
-
-.fg-menu { position:relative; }
-.fg-menu-flyout .fg-menu { position:static; }
-
-.fg-menu ul { position:absolute; top:0; }
-.fg-menu ul ul { top:-1px; }
-
-.fg-menu-container.fg-menu-ipod .fg-menu-content,
-.fg-menu-container.fg-menu-ipod .fg-menu-content ul { background: none !important; }
-
-.fg-menu.fg-menu-scroll,
-.fg-menu ul.fg-menu-scroll { overflow: scroll; overflow-x: hidden; }
-
-.fg-menu li { clear:both; float:left; width:100%; margin: 0; padding:0; border: 0; }
-.fg-menu li li { font-size:1em; } /* inner li font size must be reset so that they don't blow up */
-
-.fg-menu-flyout ul ul { padding: .4em; }
-.fg-menu-flyout li { position:relative; }
-
-.fg-menu-scroll { overflow: scroll; overflow-x: hidden; }
-
-.fg-menu-breadcrumb { margin: 0; padding: 0; }
-
-.fg-menu-footer { margin-top: .4em; padding: .4em; }
-.fg-menu-header { margin-bottom: .4em; padding: .4em; }
-
-.fg-menu-breadcrumb li { float: left; list-style: none; margin: 0; padding: 0 .2em; font-size: .9em; opacity: .7; }
-.fg-menu-breadcrumb li.fg-menu-prev-list,
-.fg-menu-breadcrumb li.fg-menu-current-crumb { clear: left; float: none; opacity: 1; }
-.fg-menu-breadcrumb li.fg-menu-current-crumb { padding-top: .2em; }
-
-.fg-menu-breadcrumb a,
-.fg-menu-breadcrumb span { float: left; }
-
-.fg-menu-footer a:link,
-.fg-menu-footer a:visited { float:left; width:100%; text-decoration: none; }
-.fg-menu-footer a:hover,
-.fg-menu-footer a:active { }
-
-.fg-menu-footer a span { float:left; cursor: pointer; }
-
-.fg-menu-breadcrumb .fg-menu-prev-list a:link,
-.fg-menu-breadcrumb .fg-menu-prev-list a:visited,
-.fg-menu-breadcrumb .fg-menu-prev-list a:hover,
-.fg-menu-breadcrumb .fg-menu-prev-list a:active { background-image: none; text-decoration:none; }
-
-.fg-menu-breadcrumb .fg-menu-prev-list a { float: left; padding-right: .4em; }
-.fg-menu-breadcrumb .fg-menu-prev-list a .ui-icon { float: left; }
-
-.fg-menu-breadcrumb .fg-menu-current-crumb a:link,
-.fg-menu-breadcrumb .fg-menu-current-crumb a:visited,
-.fg-menu-breadcrumb .fg-menu-current-crumb a:hover,
-.fg-menu-breadcrumb .fg-menu-current-crumb a:active { display:block; background-image:none; font-size:1.3em; text-decoration:none; }
-
-
-
-/* REQUIRED LINK STYLES: links are "display:block" by default; if the menu options are split into
- selectable node links and 'next' links, the script floats the node links left and floats the 'next' links to the right */
-
-.fg-menu a:link,
-.fg-menu a:visited,
-.fg-menu a:hover,
-.fg-menu a:active { float:left; width:92%; padding:.3em 3%; text-decoration:none; outline: 0 !important; }
-
-.fg-menu a { border: 1px dashed transparent; }
-
-.fg-menu a.ui-state-default:link,
-.fg-menu a.ui-state-default:visited,
-.fg-menu a.ui-state-default:hover,
-.fg-menu a.ui-state-default:active,
-.fg-menu a.ui-state-hover:link,
-.fg-menu a.ui-state-hover:visited,
-.fg-menu a.ui-state-hover:hover,
-.fg-menu a.ui-state-hover:active,
- .fg-menu a.ui-state-active:link,
- .fg-menu a.ui-state-active:visited,
- .fg-menu a.ui-state-active:hover,
-.fg-menu a.ui-state-active:active { border-style: solid; font-weight: normal; }
-
-.fg-menu a span { display:block; cursor:pointer; }
-
-
- /* SUGGESTED STYLES - for use with jQuery UI Themeroller CSS */
-
-.fg-menu-indicator span { float:left; }
-.fg-menu-indicator span.ui-icon { float:right; }
-
-.fg-menu-content.ui-widget-content,
-.fg-menu-content ul.ui-widget-content { border:0; }
-
-
-/* ICONS AND DIVIDERS */
-
-.fg-menu.fg-menu-has-icons a:link,
-.fg-menu.fg-menu-has-icons a:visited,
-.fg-menu.fg-menu-has-icons a:hover,
-.fg-menu.fg-menu-has-icons a:active { padding-left:20px; }
-
-.fg-menu .horizontal-divider hr, .fg-menu .horizontal-divider span { padding:0; margin:5px .6em; }
-.fg-menu .horizontal-divider hr { border:0; height:1px; }
-.fg-menu .horizontal-divider span { font-size:.9em; text-transform: uppercase; padding-left:.2em; }
-
deleted file mode 100644
--- a/mail/test/resources/mozmill/mozmill/extension/content/css/mozmill.css
+++ /dev/null
@@ -1,108 +0,0 @@
-body{ font: 11px Corbel, Verdana, Helvetica, arial, sans-serif; background-color: window; margin: 0; padding: 0;}
-
-#tabs { position: relative;}
-
-.tab {
- font-size: 12px;
-}
-
-.bespin {
- margin: 0;
- padding: 0;
- height: 100%;
- width: 100%;
-}
-
-#fileMenuButton {
- float: left;
- cursor: pointer;
-}
-
-#openTabs {
- position: relative;
- top: -4px;
- margin-left: 16%;
-}
-
-
-#editor-tab-select {
- min-width: 70px;
- padding-left: 8px;
- padding-right: 10px;
-}
-
-.menu {
- font-size: 12px;
- padding-top: 3px;
- padding-left: 10px;
- padding-right: 10px;
- padding-bottom: 3px;
- background-color: #f5f5f5;
- border: 1px solid #ddd;
- -moz-border-radius: 1px;
-}
-
-.menu:hover {
- background-color: #ccc;
-}
-
-.menu:active {
- background-color: #bbb;
-}
-
-.menuitem { cursor: pointer; padding-top: 2px; font-size: 12px; padding-bottom: 2px;}
-
-.menuitem a { width: 100%}
-
-.menuitem:hover { background-color: #E7E7E7;}
-
-#dxContainer {margin-top: 16px; height: 160px;}
-
-#inspectOptions {margin-right: 10px;}
-
-#outClear {margin-left: 20px;}
-
-#elementStr { margin-bottom: 8px;}
-
-#recordToggle { margin-left: 4px;}
-
-#outClear { position: relative; top: -3px;}
-
-#shellInput {
- width: 99%;
- height: 50px;
-}
-
-#shellOutput {
- overflow: auto;
- width: 99%;
- border: 1px solid #aaa;
-}
-
-.log,
-.logger,
-.pass,
-.fail,
-.test {
- width:98%;
-}
-.log:hover,
-.logger:hover,
-.pass:hover,
-.fail:hover,
-.test:hover {}
-.pass {
- background:lightgreen;
-}
-.fail {
- background:lightpink;
-}
-.test {
- background:lightyellow;
-}
-.log {
- background:lightyellow;
-}
-.logger {
- background:lightyellow;
-}
deleted file mode 100644
index 5b5dab2ab7b1c50dea9cfe73dc5a269a92d2d4b4..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index ac8b229af950c29356abf64a6c4aa894575445f0..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index ad3d6346e00f246102f72f2e026ed0491988b394..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index 42ccba269b6e91bef12ad0fa18be651b5ef0ee68..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index 5a46b47cb16631068aee9e0bd61269fc4e95e5cd..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index 86c2baa655eac8539db34f8d9adb69ec1226201c..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index 4443fdc1a156babad4336f004eaf5ca5dfa0f9ab..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index 7c9fa6c6edcfcdd3e5b77e6f547b719e6fc66e30..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index 67560da9be4ecad1e3d3d981cf7a92d2970a2f7d..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index b425c446d2444bcf40bd35581d2171c63658634e..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index 0cd64a21a929e1dd09325a9bb5026b5517e80346..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index 2e5180e473486f8acea0c5464ff578ba11746132..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index 2db88b796a36dc0501745c6f90920cf601bfbccd..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
--- a/mail/test/resources/mozmill/mozmill/extension/content/css/smoothness/jquery-ui-1.7.1.custom.css
+++ /dev/null
@@ -1,404 +0,0 @@
-/*
-* jQuery UI CSS Framework
-* Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
-* Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses.
-*/
-
-/* Layout helpers
-----------------------------------*/
-.ui-helper-hidden { display: none; }
-.ui-helper-hidden-accessible { position: absolute; left: -99999999px; }
-.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }
-.ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; }
-.ui-helper-clearfix { display: inline-block; }
-/* required comment for clearfix to work in Opera \*/
-* html .ui-helper-clearfix { height:1%; }
-.ui-helper-clearfix { display:block; }
-/* end clearfix */
-.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }
-
-
-/* Interaction Cues
-----------------------------------*/
-.ui-state-disabled { cursor: default !important; }
-
-
-/* Icons
-----------------------------------*/
-
-/* states and images */
-.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }
-
-
-/* Misc visuals
-----------------------------------*/
-
-/* Overlays */
-.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
-
-/*
-* jQuery UI CSS Framework
-* Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
-* Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses.
-* To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Verdana,Arial,sans-serif&fwDefault=normal&fsDefault=1.1em&cornerRadius=4px&bgColorHeader=cccccc&bgTextureHeader=03_highlight_soft.png&bgImgOpacityHeader=75&borderColorHeader=aaaaaa&fcHeader=222222&iconColorHeader=222222&bgColorContent=ffffff&bgTextureContent=01_flat.png&bgImgOpacityContent=75&borderColorContent=aaaaaa&fcContent=222222&iconColorContent=222222&bgColorDefault=e6e6e6&bgTextureDefault=02_glass.png&bgImgOpacityDefault=75&borderColorDefault=d3d3d3&fcDefault=555555&iconColorDefault=888888&bgColorHover=dadada&bgTextureHover=02_glass.png&bgImgOpacityHover=75&borderColorHover=999999&fcHover=212121&iconColorHover=454545&bgColorActive=ffffff&bgTextureActive=02_glass.png&bgImgOpacityActive=65&borderColorActive=aaaaaa&fcActive=212121&iconColorActive=454545&bgColorHighlight=fbf9ee&bgTextureHighlight=02_glass.png&bgImgOpacityHighlight=55&borderColorHighlight=fcefa1&fcHighlight=363636&iconColorHighlight=2e83ff&bgColorError=fef1ec&bgTextureError=02_glass.png&bgImgOpacityError=95&borderColorError=cd0a0a&fcError=cd0a0a&iconColorError=cd0a0a&bgColorOverlay=aaaaaa&bgTextureOverlay=01_flat.png&bgImgOpacityOverlay=0&opacityOverlay=30&bgColorShadow=aaaaaa&bgTextureShadow=01_flat.png&bgImgOpacityShadow=0&opacityShadow=30&thicknessShadow=8px&offsetTopShadow=-8px&offsetLeftShadow=-8px&cornerRadiusShadow=8px
-*/
-
-
-/* Component containers
-----------------------------------*/
-.ui-widget { font-family: Verdana,Arial,sans-serif; font-size: 1.1em; }
-.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Verdana,Arial,sans-serif; font-size: 1em; }
-.ui-widget-content { border: 1px solid #aaaaaa; background: #ffffff url(images/ui-bg_flat_75_ffffff_40x100.png) 50% 50% repeat-x; color: #222222; }
-.ui-widget-content a { color: #222222; }
-.ui-widget-header { border: 1px solid #aaaaaa; background: #cccccc url(images/ui-bg_highlight-soft_75_cccccc_1x100.png) 50% 50% repeat-x; color: #222222; font-weight: bold; }
-.ui-widget-header a { color: #222222; }
-
-/* Interaction states
-----------------------------------*/
-.ui-state-default, .ui-widget-content .ui-state-default { border: 1px solid #d3d3d3; background: #e6e6e6 url(images/ui-bg_glass_75_e6e6e6_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #333; outline: none; }
-.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #333; text-decoration: none; outline: none; }
-.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus { border: 1px solid #999999; background: #dadada url(images/ui-bg_glass_75_dadada_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #212121; outline: none; }
-.ui-state-hover a, .ui-state-hover a:hover { color: #212121; text-decoration: none; outline: none; }
-.ui-state-active, .ui-widget-content .ui-state-active { border: 1px solid #aaaaaa; background: #ffffff url(images/ui-bg_glass_65_ffffff_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #212121; outline: none; }
-.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #212121; outline: none; text-decoration: none; }
-
-/* Interaction Cues
-----------------------------------*/
-.ui-state-highlight, .ui-widget-content .ui-state-highlight {border: 1px solid #fcefa1; background: #fbf9ee url(images/ui-bg_glass_55_fbf9ee_1x400.png) 50% 50% repeat-x; color: #363636; }
-.ui-state-highlight a, .ui-widget-content .ui-state-highlight a { color: #363636; }
-.ui-state-error, .ui-widget-content .ui-state-error {border: 1px solid #cd0a0a; background: #fef1ec url(images/ui-bg_glass_95_fef1ec_1x400.png) 50% 50% repeat-x; color: #cd0a0a; }
-.ui-state-error a, .ui-widget-content .ui-state-error a { color: #cd0a0a; }
-.ui-state-error-text, .ui-widget-content .ui-state-error-text { color: #cd0a0a; }
-.ui-state-disabled, .ui-widget-content .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; }
-.ui-priority-primary, .ui-widget-content .ui-priority-primary { font-weight: bold; }
-.ui-priority-secondary, .ui-widget-content .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; }
-
-/* Icons
-----------------------------------*/
-
-/* states and images */
-.ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_222222_256x240.png); }
-.ui-widget-content .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); }
-.ui-widget-header .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); }
-.ui-state-default .ui-icon { background-image: url(images/ui-icons_888888_256x240.png); }
-.ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_454545_256x240.png); }
-.ui-state-active .ui-icon {background-image: url(images/ui-icons_454545_256x240.png); }
-.ui-state-highlight .ui-icon {background-image: url(images/ui-icons_2e83ff_256x240.png); }
-.ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_cd0a0a_256x240.png); }
-
-/* positioning */
-.ui-icon-carat-1-n { background-position: 0 0; }
-.ui-icon-carat-1-ne { background-position: -16px 0; }
-.ui-icon-carat-1-e { background-position: -32px 0; }
-.ui-icon-carat-1-se { background-position: -48px 0; }
-.ui-icon-carat-1-s { background-position: -64px 0; }
-.ui-icon-carat-1-sw { background-position: -80px 0; }
-.ui-icon-carat-1-w { background-position: -96px 0; }
-.ui-icon-carat-1-nw { background-position: -112px 0; }
-.ui-icon-carat-2-n-s { background-position: -128px 0; }
-.ui-icon-carat-2-e-w { background-position: -144px 0; }
-.ui-icon-triangle-1-n { background-position: 0 -16px; }
-.ui-icon-triangle-1-ne { background-position: -16px -16px; }
-.ui-icon-triangle-1-e { background-position: -32px -16px; }
-.ui-icon-triangle-1-se { background-position: -48px -16px; }
-.ui-icon-triangle-1-s { background-position: -64px -16px; }
-.ui-icon-triangle-1-sw { background-position: -80px -16px; }
-.ui-icon-triangle-1-w { background-position: -96px -16px; }
-.ui-icon-triangle-1-nw { background-position: -112px -16px; }
-.ui-icon-triangle-2-n-s { background-position: -128px -16px; }
-.ui-icon-triangle-2-e-w { background-position: -144px -16px; }
-.ui-icon-arrow-1-n { background-position: 0 -32px; }
-.ui-icon-arrow-1-ne { background-position: -16px -32px; }
-.ui-icon-arrow-1-e { background-position: -32px -32px; }
-.ui-icon-arrow-1-se { background-position: -48px -32px; }
-.ui-icon-arrow-1-s { background-position: -64px -32px; }
-.ui-icon-arrow-1-sw { background-position: -80px -32px; }
-.ui-icon-arrow-1-w { background-position: -96px -32px; }
-.ui-icon-arrow-1-nw { background-position: -112px -32px; }
-.ui-icon-arrow-2-n-s { background-position: -128px -32px; }
-.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
-.ui-icon-arrow-2-e-w { background-position: -160px -32px; }
-.ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
-.ui-icon-arrowstop-1-n { background-position: -192px -32px; }
-.ui-icon-arrowstop-1-e { background-position: -208px -32px; }
-.ui-icon-arrowstop-1-s { background-position: -224px -32px; }
-.ui-icon-arrowstop-1-w { background-position: -240px -32px; }
-.ui-icon-arrowthick-1-n { background-position: 0 -48px; }
-.ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
-.ui-icon-arrowthick-1-e { background-position: -32px -48px; }
-.ui-icon-arrowthick-1-se { background-position: -48px -48px; }
-.ui-icon-arrowthick-1-s { background-position: -64px -48px; }
-.ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
-.ui-icon-arrowthick-1-w { background-position: -96px -48px; }
-.ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
-.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
-.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
-.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
-.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
-.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
-.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
-.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
-.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
-.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
-.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
-.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
-.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
-.ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
-.ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
-.ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
-.ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
-.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
-.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
-.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
-.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
-.ui-icon-arrow-4 { background-position: 0 -80px; }
-.ui-icon-arrow-4-diag { background-position: -16px -80px; }
-.ui-icon-extlink { background-position: -32px -80px; }
-.ui-icon-newwin { background-position: -48px -80px; }
-.ui-icon-refresh { background-position: -64px -80px; }
-.ui-icon-shuffle { background-position: -80px -80px; }
-.ui-icon-transfer-e-w { background-position: -96px -80px; }
-.ui-icon-transferthick-e-w { background-position: -112px -80px; }
-.ui-icon-folder-collapsed { background-position: 0 -96px; }
-.ui-icon-folder-open { background-position: -16px -96px; }
-.ui-icon-document { background-position: -32px -96px; }
-.ui-icon-document-b { background-position: -48px -96px; }
-.ui-icon-note { background-position: -64px -96px; }
-.ui-icon-mail-closed { background-position: -80px -96px; }
-.ui-icon-mail-open { background-position: -96px -96px; }
-.ui-icon-suitcase { background-position: -112px -96px; }
-.ui-icon-comment { background-position: -128px -96px; }
-.ui-icon-person { background-position: -144px -96px; }
-.ui-icon-print { background-position: -160px -96px; }
-.ui-icon-trash { background-position: -176px -96px; }
-.ui-icon-locked { background-position: -192px -96px; }
-.ui-icon-unlocked { background-position: -208px -96px; }
-.ui-icon-bookmark { background-position: -224px -96px; }
-.ui-icon-tag { background-position: -240px -96px; }
-.ui-icon-home { background-position: 0 -112px; }
-.ui-icon-flag { background-position: -16px -112px; }
-.ui-icon-calendar { background-position: -32px -112px; }
-.ui-icon-cart { background-position: -48px -112px; }
-.ui-icon-pencil { background-position: -64px -112px; }
-.ui-icon-clock { background-position: -80px -112px; }
-.ui-icon-disk { background-position: -96px -112px; }
-.ui-icon-calculator { background-position: -112px -112px; }
-.ui-icon-zoomin { background-position: -128px -112px; }
-.ui-icon-zoomout { background-position: -144px -112px; }
-.ui-icon-search { background-position: -160px -112px; }
-.ui-icon-wrench { background-position: -176px -112px; }
-.ui-icon-gear { background-position: -192px -112px; }
-.ui-icon-heart { background-position: -208px -112px; }
-.ui-icon-star { background-position: -224px -112px; }
-.ui-icon-link { background-position: -240px -112px; }
-.ui-icon-cancel { background-position: 0 -128px; }
-.ui-icon-plus { background-position: -16px -128px; }
-.ui-icon-plusthick { background-position: -32px -128px; }
-.ui-icon-minus { background-position: -48px -128px; }
-.ui-icon-minusthick { background-position: -64px -128px; }
-.ui-icon-close { background-position: -80px -128px; }
-.ui-icon-closethick { background-position: -96px -128px; }
-.ui-icon-key { background-position: -112px -128px; }
-.ui-icon-lightbulb { background-position: -128px -128px; }
-.ui-icon-scissors { background-position: -144px -128px; }
-.ui-icon-clipboard { background-position: -160px -128px; }
-.ui-icon-copy { background-position: -176px -128px; }
-.ui-icon-contact { background-position: -192px -128px; }
-.ui-icon-image { background-position: -208px -128px; }
-.ui-icon-video { background-position: -224px -128px; }
-.ui-icon-script { background-position: -240px -128px; }
-.ui-icon-alert { background-position: 0 -144px; }
-.ui-icon-info { background-position: -16px -144px; }
-.ui-icon-notice { background-position: -32px -144px; }
-.ui-icon-help { background-position: -48px -144px; }
-.ui-icon-check { background-position: -64px -144px; }
-.ui-icon-bullet { background-position: -80px -144px; }
-.ui-icon-radio-off { background-position: -96px -144px; }
-.ui-icon-radio-on { background-position: -112px -144px; }
-.ui-icon-pin-w { background-position: -128px -144px; }
-.ui-icon-pin-s { background-position: -144px -144px; }
-.ui-icon-play { background-position: 0 -160px; }
-.ui-icon-pause { background-position: -16px -160px; }
-.ui-icon-seek-next { background-position: -32px -160px; }
-.ui-icon-seek-prev { background-position: -48px -160px; }
-.ui-icon-seek-end { background-position: -64px -160px; }
-.ui-icon-seek-first { background-position: -80px -160px; }
-.ui-icon-stop { background-position: -96px -160px; }
-.ui-icon-eject { background-position: -112px -160px; }
-.ui-icon-volume-off { background-position: -128px -160px; }
-.ui-icon-volume-on { background-position: -144px -160px; }
-.ui-icon-power { background-position: 0 -176px; }
-.ui-icon-signal-diag { background-position: -16px -176px; }
-.ui-icon-signal { background-position: -32px -176px; }
-.ui-icon-battery-0 { background-position: -48px -176px; }
-.ui-icon-battery-1 { background-position: -64px -176px; }
-.ui-icon-battery-2 { background-position: -80px -176px; }
-.ui-icon-battery-3 { background-position: -96px -176px; }
-.ui-icon-circle-plus { background-position: 0 -192px; }
-.ui-icon-circle-minus { background-position: -16px -192px; }
-.ui-icon-circle-close { background-position: -32px -192px; }
-.ui-icon-circle-triangle-e { background-position: -48px -192px; }
-.ui-icon-circle-triangle-s { background-position: -64px -192px; }
-.ui-icon-circle-triangle-w { background-position: -80px -192px; }
-.ui-icon-circle-triangle-n { background-position: -96px -192px; }
-.ui-icon-circle-arrow-e { background-position: -112px -192px; }
-.ui-icon-circle-arrow-s { background-position: -128px -192px; }
-.ui-icon-circle-arrow-w { background-position: -144px -192px; }
-.ui-icon-circle-arrow-n { background-position: -160px -192px; }
-.ui-icon-circle-zoomin { background-position: -176px -192px; }
-.ui-icon-circle-zoomout { background-position: -192px -192px; }
-.ui-icon-circle-check { background-position: -208px -192px; }
-.ui-icon-circlesmall-plus { background-position: 0 -208px; }
-.ui-icon-circlesmall-minus { background-position: -16px -208px; }
-.ui-icon-circlesmall-close { background-position: -32px -208px; }
-.ui-icon-squaresmall-plus { background-position: -48px -208px; }
-.ui-icon-squaresmall-minus { background-position: -64px -208px; }
-.ui-icon-squaresmall-close { background-position: -80px -208px; }
-.ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
-.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
-.ui-icon-grip-solid-vertical { background-position: -32px -224px; }
-.ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
-.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
-.ui-icon-grip-diagonal-se { background-position: -80px -224px; }
-
-
-/* Misc visuals
-----------------------------------*/
-
-/* Corner radius */
-.ui-corner-tl { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; }
-.ui-corner-tr { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; }
-.ui-corner-bl { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; }
-.ui-corner-br { -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; }
-.ui-corner-top { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; }
-.ui-corner-bottom { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; }
-.ui-corner-right { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; }
-.ui-corner-left { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; }
-.ui-corner-all { -moz-border-radius: 4px; -webkit-border-radius: 4px; }
-
-/* Overlays */
-.ui-widget-overlay { background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); }
-.ui-widget-shadow { margin: -8px 0 0 -8px; padding: 8px; background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); -moz-border-radius: 8px; -webkit-border-radius: 8px; }/* Accordion
-----------------------------------*/
-.ui-accordion .ui-accordion-header { cursor: pointer; position: relative; margin-top: 1px; zoom: 1; }
-.ui-accordion .ui-accordion-li-fix { display: inline; }
-.ui-accordion .ui-accordion-header-active { border-bottom: 0 !important; }
-.ui-accordion .ui-accordion-header a { display: block; font-size: 1em; padding: .5em .5em .5em 2.2em; }
-.ui-accordion .ui-accordion-header .ui-icon { position: absolute; left: .5em; top: 50%; margin-top: -8px; }
-.ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; margin-top: -2px; position: relative; top: 1px; margin-bottom: 2px; overflow: auto; display: none; }
-.ui-accordion .ui-accordion-content-active { display: block; }/* Datepicker
-----------------------------------*/
-.ui-datepicker { width: 17em; padding: .2em .2em 0; }
-.ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; }
-.ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; }
-.ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; }
-.ui-datepicker .ui-datepicker-prev { left:2px; }
-.ui-datepicker .ui-datepicker-next { right:2px; }
-.ui-datepicker .ui-datepicker-prev-hover { left:1px; }
-.ui-datepicker .ui-datepicker-next-hover { right:1px; }
-.ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px; }
-.ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; }
-.ui-datepicker .ui-datepicker-title select { float:left; font-size:1em; margin:1px 0; }
-.ui-datepicker select.ui-datepicker-month-year {width: 100%;}
-.ui-datepicker select.ui-datepicker-month,
-.ui-datepicker select.ui-datepicker-year { width: 49%;}
-.ui-datepicker .ui-datepicker-title select.ui-datepicker-year { float: right; }
-.ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; }
-.ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0; }
-.ui-datepicker td { border: 0; padding: 1px; }
-.ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; }
-.ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0; }
-.ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; }
-.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; }
-
-/* with multiple calendars */
-.ui-datepicker.ui-datepicker-multi { width:auto; }
-.ui-datepicker-multi .ui-datepicker-group { float:left; }
-.ui-datepicker-multi .ui-datepicker-group table { width:95%; margin:0 auto .4em; }
-.ui-datepicker-multi-2 .ui-datepicker-group { width:50%; }
-.ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; }
-.ui-datepicker-multi-4 .ui-datepicker-group { width:25%; }
-.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; }
-.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; }
-.ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; }
-.ui-datepicker-row-break { clear:both; width:100%; }
-
-/* RTL support */
-.ui-datepicker-rtl { direction: rtl; }
-.ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; }
-.ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; }
-.ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; }
-.ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; }
-.ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; }
-.ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; }
-.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; }
-.ui-datepicker-rtl .ui-datepicker-group { float:right; }
-.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
-.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
-
-/* IE6 IFRAME FIX (taken from datepicker 1.5.3 */
-.ui-datepicker-cover {
- display: none; /*sorry for IE5*/
- display/**/: block; /*sorry for IE5*/
- position: absolute; /*must have*/
- z-index: -1; /*must have*/
- filter: mask(); /*must have*/
- top: -4px; /*must have*/
- left: -4px; /*must have*/
- width: 200px; /*must have*/
- height: 200px; /*must have*/
-}/* Dialog
-----------------------------------*/
-.ui-dialog { position: relative; padding: .2em; width: 300px; }
-.ui-dialog .ui-dialog-titlebar { padding: .5em .3em .3em 1em; position: relative; }
-.ui-dialog .ui-dialog-title { float: left; margin: .1em 0 .2em; }
-.ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; }
-.ui-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; }
-.ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; }
-.ui-dialog .ui-dialog-content { border: 0; padding: .5em 1em; background: none; overflow: auto; zoom: 1; }
-.ui-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin: .5em 0 0 0; padding: .3em 1em .5em .4em; }
-.ui-dialog .ui-dialog-buttonpane button { float: right; margin: .5em .4em .5em 0; cursor: pointer; padding: .2em .6em .3em .6em; line-height: 1.4em; width:auto; overflow:visible; }
-.ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; }
-.ui-draggable .ui-dialog-titlebar { cursor: move; }
-/* Progressbar
-----------------------------------*/
-.ui-progressbar { height:2em; text-align: left; }
-.ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; }/* Resizable
-----------------------------------*/
-.ui-resizable { position: relative;}
-.ui-resizable-handle { position: absolute;font-size: 0.1px;z-index: 99999; display: block;}
-.ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; }
-.ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0px; }
-.ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0px; }
-.ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0px; height: 100%; }
-.ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0px; height: 100%; }
-.ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; }
-.ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; }
-.ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; }
-.ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}/* Slider
-----------------------------------*/
-.ui-slider { position: relative; text-align: left; }
-.ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; }
-.ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; }
-
-.ui-slider-horizontal { height: .8em; }
-.ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; }
-.ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; }
-.ui-slider-horizontal .ui-slider-range-min { left: 0; }
-.ui-slider-horizontal .ui-slider-range-max { right: 0; }
-
-.ui-slider-vertical { width: .8em; height: 100px; }
-.ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; }
-.ui-slider-vertical .ui-slider-range { left: 0; width: 100%; }
-.ui-slider-vertical .ui-slider-range-min { bottom: 0; }
-.ui-slider-vertical .ui-slider-range-max { top: 0; }/* Tabs
-----------------------------------*/
-.ui-tabs { padding: .2em; zoom: 1; }
-.ui-tabs .ui-tabs-nav { list-style: none; position: relative; padding: .6em .2em 0 .2em; }
-.ui-tabs .ui-tabs-nav li { position: relative; float: left; border-bottom-width: 0 !important; margin: 0 .2em -1px 0; padding: 0; }
-.ui-tabs .ui-tabs-nav li a { float: left; text-decoration: none; padding: .5em 1em; }
-.ui-tabs .ui-tabs-nav li.ui-tabs-selected { padding-bottom: 1px; border-bottom-width: 0; }
-.ui-tabs .ui-tabs-nav li.ui-tabs-selected a, .ui-tabs .ui-tabs-nav li.ui-state-disabled a, .ui-tabs .ui-tabs-nav li.ui-state-processing a { cursor: text; }
-.ui-tabs .ui-tabs-nav li a, .ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a { cursor: pointer; } /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */
-.ui-tabs .ui-tabs-panel { padding: 1.4em 1.2em; display: block; border-width: 0; background: none; }
-.ui-tabs .ui-tabs-hide { display: none !important; }
deleted file mode 100644
--- a/mail/test/resources/mozmill/mozmill/extension/content/dx.js
+++ /dev/null
@@ -1,231 +0,0 @@
-// ***** BEGIN LICENSE BLOCK *****
-// Version: MPL 1.1/GPL 2.0/LGPL 2.1
-//
-// The contents of this file are subject to the Mozilla Public License Version
-// 1.1 (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-// http://www.mozilla.org/MPL/
-//
-// Software distributed under the License is distributed on an "AS IS" basis,
-// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-// for the specific language governing rights and limitations under the
-// License.
-//
-// The Original Code is Mozilla Corporation Code.
-//
-// The Initial Developer of the Original Code is
-// Adam Christian.
-// Portions created by the Initial Developer are Copyright (C) 2008
-// the Initial Developer. All Rights Reserved.
-//
-// Contributor(s):
-// Adam Christian <adam.christian@gmail.com>
-// Mikeal Rogers <mikeal.rogers@gmail.com>
-//
-// Alternatively, the contents of this file may be used under the terms of
-// either the GNU General Public License Version 2 or later (the "GPL"), or
-// the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-// in which case the provisions of the GPL or the LGPL are applicable instead
-// of those above. If you wish to allow use of your version of this file only
-// under the terms of either the GPL or the LGPL, and not to allow others to
-// use your version of this file under the terms of the MPL, indicate your
-// decision by deleting the provisions above and replace them with the notice
-// and other provisions required by the GPL or the LGPL. If you do not delete
-// the provisions above, a recipient may use your version of this file under
-// the terms of any one of the MPL, the GPL or the LGPL.
-//
-// ***** END LICENSE BLOCK *****
-
-var inspection = {}; Components.utils.import('resource://mozmill/modules/inspection.js', inspection);
-var utils = {}; Components.utils.import('resource://mozmill/modules/utils.js', utils);
-
-var DomInspectorConnector = function() {
- this.lastEvent = null;
- this.lastTime = null;
- this.on = false;
-}
-DomInspectorConnector.prototype.grab = function(){
- var disp = $('dxDisplay').textContent;
- var dispArr = disp.split(': ');
- $('editorInput').value += 'new elementslib.'+dispArr[0].toUpperCase()+"('"+dispArr[1]+"')\n";
-}
-
-DomInspectorConnector.prototype.changeClick = function(e) {
- if (this.on){
- this.dxOff()
- this.dxOn();
- }
-}
-
-DomInspectorConnector.prototype.evtDispatch = function(e) {
-
- //if this function was called less than a second ago, exit
- //this should solve the flickering problem
- var currentTime = new Date();
- var newTime = currentTime.getTime();
-
- if (this.lastTime != null){
- var timeDiff = newTime - this.lastTime;
- this.lastTime = newTime;
-
- if (timeDiff < 2){
- this.lastEvent = e;
- return;
- }
- } else { this.lastTime = newTime; }
-
- //Fix the scroll bar exception Bug 472124
- try { var i = inspection.inspectElement(e); }
- catch(err){ return; }
-
- var dxC = i.controllerText;
- var dxE = i.elementText;
- var dxV = String(i.validation);
-
- document.getElementById('dxController').innerHTML = dxC;
- document.getElementById('dxValidation').innerHTML = dxV;
- document.getElementById('dxElement').innerHTML = dxE;
-
- return dxE;
-}
-DomInspectorConnector.prototype.dxToggle = function(){
- if (this.on)
- this.dxOff();
- else
- this.dxOn();
-}
-//Turn on the recorder
-//Since the click event does things like firing twice when a double click goes also
-//and can be obnoxious im enabling it to be turned off and on with a toggle check box
-DomInspectorConnector.prototype.dxOn = function() {
- this.on = true;
- $("#dxToggle").text("Stop");
-
- //defined the click method, default to dblclick
- var clickMethod = "dblclick";
- if (document.getElementById('inspectSingle').checked){
- clickMethod = 'click';
- }
-
- var enumerator = Components.classes["@mozilla.org/appshell/window-mediator;1"]
- .getService(Components.interfaces.nsIWindowMediator)
- .getEnumerator("");
- while(enumerator.hasMoreElements()) {
- var win = enumerator.getNext();
- if (win.document.title != 'MozMill IDE'){
- this.dxRecursiveBind(win, clickMethod);
- }
- }
-
- var observerService =
- Components.classes["@mozilla.org/observer-service;1"]
- .getService(Components.interfaces.nsIObserverService);
-
- observerService.addObserver(this.observer, "toplevel-window-ready", false);
-};
-
-//when a new dom window gets opened
-DomInspectorConnector.prototype.observer = {
- observe: function(subject,topic,data){
- var clickMethod = "dblclick";
- if ($('inspectSingle').selected){
- clickMethod = 'click';
- }
- //Attach listener to new window here
- MozMilldx.dxRecursiveBind(subject, clickMethod);
- }
-};
-
-DomInspectorConnector.prototype.dxOff = function() {
- this.on = false;
- $("#dxToggle").text("Start");
- $("#dxCopy").show();
-
- //try to cleanup left over outlines
- if (this.lastEvent){
- this.lastEvent.target.style.outline = "";
- }
-
- for each(win in utils.getWindows()) {
- this.dxRecursiveUnBind(win, 'click');
- }
-
- for each(win in utils.getWindows()) {
- this.dxRecursiveUnBind(win, 'dblclick');
- }
-
- var observerService =
- Components.classes["@mozilla.org/observer-service;1"]
- .getService(Components.interfaces.nsIObserverService);
-
- try {
- observerService.removeObserver(this.observer, "toplevel-window-ready");
- } catch(err){}
-};
-
-DomInspectorConnector.prototype.getFoc = function(e){
- MozMilldx.dxOff();
- e.target.style.outline = "";
- e.stopPropagation();
- e.preventDefault();
- window.focus();
-}
-
-DomInspectorConnector.prototype.inspectorToClipboard = function(){
- copyToClipboard($('#dxController')[0].innerHTML +'\n'+$('#dxElement')[0].innerHTML);
-};
-
-//Copy inspector output to clipboard if alt,shift,c is pressed
-DomInspectorConnector.prototype.clipCopy = function(e){
- if (e == true){
- copyToClipboard($('#dxElement')[0].innerHTML + ' '+$('#dxValidation')[0].innerHTML + ' ' + $('#dxController')[0].innerHTML);
- }
- else if (e.altKey && e.shiftKey && (e.charCode == 199)){
- copyToClipboard($('#dxElement')[0].innerHTML + ' '+$('#dxValidation')[0].innerHTML + ' ' + $('#dxController')[0].innerHTML);
- }
-}
-
-//Recursively bind to all the iframes and frames within
-DomInspectorConnector.prototype.dxRecursiveBind = function(frame, clickMethod) {
-
- frame.addEventListener('mouseover', this.evtDispatch, true);
- frame.addEventListener('mouseout', this.evtDispatch, true);
- frame.addEventListener(clickMethod, this.getFoc, true);
- frame.addEventListener('keypress', this.clipCopy, true);
-
-
- var iframeCount = frame.window.frames.length;
- var iframeArray = frame.window.frames;
-
- for (var i = 0; i < iframeCount; i++)
- this.dxRecursiveBind(iframeArray[i], clickMethod);
-}
-
-//Recursively bind to all the iframes and frames within
-DomInspectorConnector.prototype.dxRecursiveUnBind = function(frame, clickMethod) {
- try {
- frame.removeEventListener('mouseover', this.evtDispatch, true);
- frame.removeEventListener('mouseout', this.evtDispatch, true);
- frame.removeEventListener(clickMethod, this.getFoc, true);
- frame.removeEventListener('keypress', this.clipCopy, true);
- }
- catch(e) {
- // don't want to prevent the rest of the frames from removing listeners
- }
-
- var iframeCount = frame.window.frames.length;
- var iframeArray = frame.window.frames;
-
- for (var i = 0; i < iframeCount; i++)
- this.dxRecursiveUnBind(iframeArray[i], clickMethod);
-}
-
-var MozMilldx = new DomInspectorConnector();
-
-// Scoping bug workarounds
-var enableDX = function () {
- MozMilldx.dxOn();
-}
-var disableDX = function () {
- MozMilldx.dxOff();
-}
deleted file mode 100644
--- a/mail/test/resources/mozmill/mozmill/extension/content/dxwindow.xul
+++ /dev/null
@@ -1,14 +0,0 @@
-<?xml version="1.0"?>
-<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
-
-<prefwindow id="mozmill-dxwindow"
- title="DOM Explorer"
- xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
-
-<prefpane id="dxwindow" label="DOM Explorer">
-
- <hbox id="dxtarget" align="center">
- </hbox>
-</prefpane>
-
-</prefwindow>
\ No newline at end of file
deleted file mode 100644
--- a/mail/test/resources/mozmill/mozmill/extension/content/editor/bespin/BespinEmbedded.css
+++ /dev/null
@@ -1,123 +0,0 @@
-.bespin-completion-panel {
- font-family: Helvetica, Arial, sans-serif;
- position: absolute;
- cursor: default;
- line-height: normal;
- -moz-user-select: none;
- -webkit-user-select: none;
-}
-
-.bespin-completion-pointer {
- position: absolute;
- z-index: 2;
- height: 21px;
- width: 21px;
-}
-
-.bespin-completion-pointer-up {
- top: 1px;
- border-top: solid #555 1px;
- border-left: solid #555 1px;
- background-image: -moz-linear-gradient(top left, #333333, #333333 50%, transparent 50%, transparent);
- background-image: -webkit-gradient(linear, left top, right bottom, from(#333333), color-stop(0.5, #333333), color-stop(0.5, transparent), to(transparent));
- -moz-transform: rotate(45deg);
- -webkit-transform: rotate(45deg);
-}
-
-.bespin-completion-pointer-down {
- bottom: 1px;
- border-top: solid #000 1px;
- border-left: solid #000 1px;
- background-image: -moz-linear-gradient(top left, #000, #000 50%, transparent 50%, transparent);
- background-image: -webkit-gradient(linear, left top, right bottom, from(#000), color-stop(0.5, #000), color-stop(0.5, transparent), to(transparent));
- -moz-transform: rotate(225deg);
- -webkit-transform: rotate(225deg);
-}
-
-.bespin-completion-bubble-outer {
- position: relative;
- z-index: 1;
- margin: 11px 0px 11px 0px;
- border-top: solid #555 1px;
- -moz-border-radius: 8px;
- -webkit-border-radius: 8px;
-}
-
-.bespin-completion-bubble-inner {
- position: relative;
- z-index: 3;
- padding: 6px;
- background: -moz-linear-gradient(top, #333333, #000000);
- background: -webkit-gradient(linear, center top, center bottom, from(#333333), to(#000000));
- color: #ffffff;
- font-size: 10.5pt;
- -moz-border-radius: 8px;
- -webkit-border-radius: 8px;
- -moz-box-shadow: 0px 6px 16px 2px rgba(0, 0, 0, 0.5);
- -webkit-box-shadow: 0px 6px 16px 2px rgba(0, 0, 0, 0.5);
-}
-
-.bespin-completion-panel ul {
- list-style: none;
- margin: 0px;
- padding: 0px;
-}
-
-.bespin-completion-panel li {
- text-indent: 0px;
- margin: 0px;
- padding: 6px 16px;
-}
-
-.bespin-completion-highlight {
- position: absolute;
- z-index: -1;
- background-image: -moz-linear-gradient(top, #3e59be, #312d80);
- background-image: -webkit-gradient(linear, center top, center bottom, from(#3e59be), to(#312d80));
- border: solid rgba(37, 34, 91, 1.0) 1px;
- -moz-border-radius: 6px;
- -webkit-border-radius: 6px;
-}
-
-.bespin-completion-kind {
- display: block;
- float: left;
- top: 0px;
- left: 0px;
- width: 8px;
- height: 8px;
- padding: 2px;
- margin: 0px 5px 0px 0px;
- font-size: 6.5pt;
- font-weight: bold;
- text-transform: uppercase;
- text-align: center;
- -moz-border-radius: 3px;
- -webkit-border-radius: 3px;
-}
-
-.bespin-completion-kind-m {
- background-color: maroon;
-}
-
-.bespin-completion-kind-f {
- background-color: green;
-}
-
-.bespin-completion-top-row {
- position: relative;
-}
-
-.bespin-completion-second-row {
- margin: 6px 0px 0px 17px;
- display: none;
-}
-
-.bespin-completion-ident {
- font-weight: bold;
-}
-
-.bespin-completion-container {
- color: #a0a0a0;
-}
-
deleted file mode 100644
--- a/mail/test/resources/mozmill/mozmill/extension/content/editor/bespin/BespinEmbedded.js
+++ /dev/null
@@ -1,144 +0,0 @@
-if(typeof bespin==="undefined")bespin={};if(typeof document!=="undefined"){var link=document.getElementById("bespin_base");if(link){var href=link.href;bespin.base=href.substring(href.length-1)!=="/"?href+"/":href}else bespin.base=""}
-(function(){if("undefined"===typeof y)var y=function(){function j(w,t){x.push({m:w,a:t})}var x=[],E={isBootstrap:true,queue:x,register:function(w,t){if(w.match(/^tiki/)&&this.ENV)if(this.ENV.app==="tiki"&&this.ENV.mode==="test"){if(!t.dependencies)t.dependencies={};t.dependencies.core_test="~"}j("register",arguments);return this},module:function(w,t){if(w.match(/\:tiki$/))this.tikiFactory=t;j("module",arguments);return this},start:function(){var w={};this.tikiFactory(null,w,null);w=w.Browser.start(this.ENV,
-this.ARGS,x);x=null;return w}};if("undefined"!==typeof ENV)E.ENV=ENV;if("undefined"!==typeof ARGV)E.ARGS=ARGV;if("undefined"!==typeof ARGS)E.ARGS=ARGS;return E}();y.register("::tiki/1.0.0",{name:"tiki",version:"1.0.0"});y.module("::tiki/1.0.0:tiki",function(j,x){var E=/^::/,w=function(a){return!!E.exec(a)},t=function(){x.debug.apply(this,arguments)};x.debug=function(){var a=Array.prototype.join.call(arguments,"");j("sys").debug(a)};var h;h=Array.isArray?Array.isArray:function(a){if("object"!==typeof a)return false;
-if(a instanceof Array)return true;return a.constructor&&a.constructor.name==="Array"};x.isArray=h;var o;if(Object.create)o=Object.create;else{var s=function(){},C=s.prototype;o=function(a){if(!a)a=Object.prototype;s.prototype=a;var b=new s;b.prototype=a;s.prototype=C;return b}}x.createObject=o;var v,B,F;v=function(){return function(){return this.init?this.init.apply(this,arguments):this}};B=function(){return F(this)};F=function(a){var b=v();b.prototype=o(a.prototype);b.prototype.constructor=b;b.super_=
-a;b.extend=B;return b};x.extend=F;var f=function(a,b){if(b&&!b.displayName)b.displayName="parallel#fn";return function(c){if(a.length===0)return c(null,[]);var d=a.length,l=d,m=false,z,D=function(H){if(!m){if(H){m=true;return c(H)}--l<=0&&c()}};D.displayName="parallel#tail";for(z=0;z<d;z++)b(a[z],D)}};f.displayName="parallel";var g;g=Array.prototype.map?function(a,b){return a.map(b)}:function(a,b){var c,d=a.length,l=[];for(c=0;c<d;c++)l[c]=b(a[c],c);return l};g.displayName="map";var n=function(a,
-b){var c="pending",d=[],l=false,m=null,z=function(D){b||(b=this);switch(c){case "ready":D.apply(null,m);break;case "running":d.push(D);break;case "pending":d.push(D);c="running";a.call(b,function(){m=Array.prototype.slice.call(arguments);var H=d,M=m;if(l){c="pending";d=[];m=null;l=false}else{c="ready";d=null}H&&H.forEach(function(O){O.apply(null,M)})});break}return this};z.displayName="once#handler";z.reset=function(){switch(c){case "ready":c="pending";d=[];m=null;break;case "running":l=true;break}};
-z.reset.displayName="once#handler.reset";return z};x.once=n;var p=function(a,b){var c,d;for(c in a)if(a.hasOwnProperty(c)){d=a[c];if("function"===typeof d)if(!d.displayName){d.displayName=b?b+"."+c:c;p(d.prototype,d.displayName)}}return a},u=F(Error);u.prototype.init=function(a,b){a=a+" not found";if(b)a="string"===typeof b?a+" "+b:a+" in package "+(b.id||"(unknown)");this.message=a;return this};x.NotFound=u;var A=F(Error);A.prototype.init=function(a,b){if("undefined"!==typeof JSON)a=JSON.stringify(a);
-this.message="Invalid package definition. "+b+" "+a};x.InvalidPackageDef=A;var L=function(){var a=function(d){return d.charCodeAt(0)<=32},b=function(d){d=d.charCodeAt(0);return d>=48&&d<=57},c=function(d,l){for(var m=0,z=0,D=0,H,M;;z++,D++){H=d.charAt(z);M=l.charAt(D);if(!b(H)&&!b(M))return m;else if(b(H))if(b(M)){if(H<M)if(m===0)m=-1;else if(H>M)if(m===0)m=+1;else if(H===0&&M===0)return m}else return+1;else return-1}};return function(d,l){for(var m=0,z=0,D=0,H=0,M,O,W;;){D=H=0;M=d.charAt(m);for(O=
-l.charAt(z);a(M)||M=="0";){if(M=="0")D++;else D=0;M=d.charAt(++m)}for(;a(O)||O=="0";){if(O=="0")H++;else H=0;O=l.charAt(++z)}if(b(M)&&b(O))if((W=c(d.substring(m),l.substring(z)))!==0)return W;if(M===0&&O===0)return D-H;if(M<O)return-1;else if(M>O)return+1;++m;++z}}}();x.natcompare=L;var I=function(a){return new Error(""+a+" is an invalid version string")};I.displayName="invalidVers";var N=function(a,b,c,d){c=Number(c);d=Number(d);if(isNaN(c))throw I(a);if(isNaN(d))throw I(b);return c-d};N.displayName=
-"compareNum";var i,J={parse:function(a){a=a.match(/^(=|~)?([\d]+?)(\.([\d]+?)(\.(.+))?)?$/);if(!a)return null;return[a,a[2],a[4]||"0",a[6]||"0",a[1]]},major:function(a){return Number(i(a)[1])},minor:function(a){return Number(i(a)[2])},patch:function(a){a=i(a)[3];return isNaN(Number(a))?a:Number(a)},STRICT:"strict",NORMAL:"normal",mode:function(a){return i(a)[4]==="="?J.STRICT:J.NORMAL},comparePatch:function(a,b){var c,d;if(a===b)return 0;c=Number(a);d=Number(b);return isNaN(c)?isNaN(d)?L(a,b):-1:
-isNaN(d)?1:c<d?-1:c>d?1:0},compare:function(a,b){var c;if(a===b)return 0;if(a)a=i(a);if(b)b=i(b);if(!a&&!b)return 0;if(!a)return-1;if(!b)return 1;c=N(a[0],b[0],a[1],b[1]);if(c===0){c=N(a[0],b[0],a[2],b[2]);if(c===0)c=J.comparePatch(a[3],b[3])}return c<0?-1:c>0?1:0},compatible:function(a,b){if(!a)return true;if(a===b)return true;if(a&&!i(a))a=null;if(b&&!i(b))b=null;if(!a)return true;if(a===b)return true;if(J.mode(a)===J.STRICT)return b&&J.compare(a,b)===0;else{if(!b)return true;if(J.major(a)!==J.major(b))return false;
-return J.compare(a,b)<=0}},normalize:function(a){var b;if(!a||a.length===0)return null;a=J.parse(a);if(!a)return null;b=Number(a[3]);if(isNaN(b))b=a[3];return[Number(a[1]),Number(a[2]),b].join(".")}};x.semver=J;i=J.parse;var U=x.extend(Object);x.Factory=U;U.prototype.init=function(a,b,c){this.id=a;this.pkg=b;this.factory=c};U.prototype.call=function(a,b){var c=this.factory,d=this.__filename,l=this.__dirname;if("string"===typeof c)c=this.factory=U.compile(c,this.pkg.id+":"+this.id);a=a.createRequire(b);
-var m=b.exports;c.call(m,a,m,b,d,l);return b.exports};var R=["(function(require, exports, module) {",null,"\n});\n//@ sourceURL=",null,"\n"];U.compile=function(a,b){R[1]=a;R[3]=b||"(unknown module)";a=R.join("");a=eval(a);R[1]=R[3]=null;return a};x.Factory=U;var S=x.extend(Object);x.Module=S;S.prototype.init=function(a,b,c){this.id=a;this.ownerPackage=b;this.exports={};var d=this;this.resource=function(l){return c.resource(l,d.id,b)}};var Q=x.extend(Object);x.Package=Q;Q.prototype.init=function(a,
-b){w(a)||(a="::"+a);this.id=a;this.config=b;this.isReady=true};Q.prototype.get=function(a){return this.config?this.config[a]:undefined};Q.prototype.set=function(a,b){if(!this.config)this.config={};this.config[a]=b;return this};Q.prototype.requiredVersion=function(a){var b=this.get("dependencies");return b?b[a]:null};Q.prototype.canonicalPackageId=function(a,b){if(a===this.get("name")&&J.compatible(b,this.get("version")))return this.id;return null};Q.prototype.packageFor=function(a){if(a===this.id)return this;
-return null};Q.prototype.ensurePackage=function(a,b){return a===this.id?b():b(new u(a,this))};Q.prototype.catalogPackages=function(){return[this]};Q.prototype.exists=function(a){return!!(this.factories&&this.factories[a])};Q.prototype.load=function(a){return this.factories?this.factories[a]:null};var e=function(a,b){return a+":"+b},k=x.extend(Object);x.Loader=k;k.prototype.init=function(a){this.sources=a||[];this.clear()};k.prototype.clear=function(){this.factories={};this.canonicalIds={};this.packages=
-{};this.packageSources={};this.canonicalPackageIds={}};k.prototype.defaultPackage=new Q("default",{name:"default"});k.prototype.anonymousPackage=new Q("(anonymous)",{name:"(anonymous)"});k.prototype.canonical=function(a,b,c){var d,l,m,z;if(b&&"string"!==typeof b){c=b;b=null}if(w(a))return a;if(!c)c=this.anonymousPackage;a=this._resolve(a,b,c);if(w(a))return a;d=c?c.id:"(null)";b=this.canonicalIds;if(!b)b=this.canonicalIds={};b[d]||(b[d]={});b=b[d];if(b[a])return b[a];d=a;l=a.indexOf(":");if(l>=0){m=
-a.slice(0,l);a=a.slice(l+1);if(a[0]==="/")throw new Error("Absolute path not allowed with packageId");}l=null;if(m&&m.length>0){if(m=this._canonicalPackageId(m,null,c))l=e(m,a)}else{if(c&&c.exists(a))l=e(c.id,a);else{if(m=this._canonicalPackageId(a,null,c))z=this._packageFor(m,c);if(z)if(z.exists("index"))l=e(z.id,"index");else if(z.exists(a))l=e(z.id,a)}if(!l){if(this.defaultPackage)m=this.defaultPackage.id;else if(this.workingPackage)m=this.workingPackage.id;else if(this.anonymousPackage)m=this.anonymousPackage.id;
-else return null;if(m)l=e(m,a)}}return b[d]=l};k.prototype.load=function(a,b,c){var d,l,m;if(!b)b=this.anonymousPackage;d=this.factories;if(!d)d=this.factories={};if(d[a])return d[a];l=a.indexOf(":",2);m=a.slice(0,l);l=a.slice(l+1);(b=this._packageFor(m,b))||t("Loader#load - "+m+" not found for "+l);if(!b)return null;c=b.load(l,c);return d[a]=c};k.prototype.catalogPackages=function(a){if(!a)a=this.anonymousPackage;var b=[],c,d,l={};this.defaultPackage&&b.push(this.defaultPackage);var m=function(z){var D,
-H,M,O;if(z){H=z.length;for(D=0;D<H;D++){O=z[D];(M=l[O.get("name")])||(M=l[O.get("name")]={});if(!M[O.get("version")]){b.push(O);M[O.get("version")]=O}}}};a&&m(a.catalogPackages());a=this.sources;d=a.length;for(c=0;c<d;c++)m(a[c].catalogPackages());l=null;return b};k.prototype.canonicalPackageId=function(a,b,c){var d;if(a instanceof Q)return a.id;if(w(a)){d=a.indexOf(":",2);if(d>=0)a=a.slice(0,d);return a}if(b&&"string"!==typeof b){c=b;b=null}if(!c)c=this.anonymousPackage;d=a.indexOf(":");if(d>=0)a=
-a.slice(0,d);return this._canonicalPackageId(a,b,c)};k.prototype.packageFor=function(a,b){if(!b)b=this.anonymousPackage;var c=a.indexOf(":",2);if(c>=0)a=a.slice(0,c);return this._packageFor(a,b)};k.prototype.ready=function(a,b){if(!b)b=this.anonymousPackage;var c=a.indexOf(":",2),d;if(c>=0){d=a.slice(c+1);a=a.slice(0,c)}if(this._packageReady(a,b,{})){a=this._packageFor(a,b);if(!a)return false;return!!a.exists(d)}else return false};k.prototype.ensurePackage=function(a,b,c,d){if(b&&"string"!==typeof b){d=
-c;c=b;b=null}if(c&&"function"===typeof c){d=c;c=null}if(!c)c=this.anonymousPackage;this._ensurePackage(a,b,c,{},d)};k.prototype._ensurePackage=function(a,b,c,d,l){var m=this,z;z=this._canonicalPackageId(a,b,c);if(!z)return l(new u(a,c));if(d[z])return l();d[z]=true;a=this._sourceForCanonicalPackageId(z,c);if(!a)return l(new u(z,c));a.ensurePackage(z,function(D){var H,M,O;if(D)return l(D);H=m.packageFor(z,c);if(!H)return l(new u(z,c));D=H.get("dependencies");if(!D)return l();O=[];for(M in D)D.hasOwnProperty(M)&&
-O.push({packageId:M,vers:D[M]});f(O,function(W,V){m._ensurePackage(W.packageId,W.vers,H,d,V)})(l)})};k.prototype._canonicalPackageId=function(a,b,c){if(a instanceof Q)return a.id;if(w(a))return a;if(a==="default"&&this.defaultPackage)return this.defaultPackage.id;var d=this.canonicalPackageIds,l,m,z,D,H;if(!c)c=this.anonymousPackage;if(!c)throw new Error("working package is required");b||(b=c.requiredVersion(a));l=c.id;if(!d)d=this.canonicalPackageIds={};d[l]||(d[l]={});d=d[l];d[a]||(d[a]={});d=d[a];
-if(d[b])return d[b];l=this.sources;m=c.canonicalPackageId(a,b);H=c;if(!m)if(m=c.canonicalPackageId(a,null))throw new Error(c.get("name")+" contains an incompatible nested package "+a+" (expected: "+b+")");if(!m&&l){D=l.length;for(z=0;!m&&z<D;z++){H=l[z];m=H.canonicalPackageId(a,b)}}m&&this._cachePackageSource(m,c,H);return d[b]=m};k.prototype._cachePackageSource=function(a,b,c){var d=this.packageSources;b=b.id;if(!d)d=this.packageSources={};d[b]||(d[b]={});d=d[b];d[a]=c};k.prototype._sourceForCanonicalPackageId=
-function(a,b){var c=this.packageSources,d=b.id,l,m;if(!c)c=this.packageSources={};c[d]||(c[d]={});c=c[d];if(c[a])return c[a];d=this.sources;if(b)if(l=b.packageFor(a))m=b;if(!m&&d){b=d.length;for(l=0;!m&&l<b;l++){m=d[l];m.packageFor(a)||(m=null)}}return c[a]=m};k.prototype._packageFor=function(a,b){var c,d;if(this.defaultPackage&&a===this.defaultPackage.id)return this.defaultPackage;c=this.packages;if(!c)c=this.packages={};if(c[a])return c[a];if(b=this._sourceForCanonicalPackageId(a,b))d=b.packageFor(a);
-return c[a]=d};k.prototype._packageReady=function(a,b,c){var d;if(c[a])return true;c[a]=true;b=this._packageFor(a,b);if(!b)return false;a=b.get("dependencies");for(d in a)if(a.hasOwnProperty(d)){a=a[d];a=this._canonicalPackageId(d,a,b);if(!a)return false;return this._packageReady(a,b,c)}return true};k.prototype._resolve=function(a,b,c){var d,l,m,z;if(a[0]==="/"&&a.indexOf(":")<0)return this.anonymousPackage.id+":"+a;if(a.match(/(^\.\.?\/)|(\/\.\.?\/)|(\/\.\.?\/?$)/)){if((d=a.indexOf(":"))>=0){z=a.slice(0,
-d);a=a.slice(d+1);b=[]}else if(a.match(/^\.\.?\//)){if(!b)throw new Error("id required to resolve relative id: "+a);if(b.indexOf(":")>=0)throw new Error("current moduleId cannot contain packageId");if(c)z=c.id;b=b.split("/");b.pop()}else b=[];m=a.split("/");c=m.length;for(d=0;d<c;d++){l=m[d];if(l===".."){if(b.length<1)throw new Error("invalid path: "+a);b.pop()}else l!=="."&&b.push(l)}a=b.join("/");if(z)a=e(z,a)}return a};var r=x.extend(Object);x.Sandbox=r;r.prototype.init=function(a,b,c,d){this.loader=
-a;this.env=b;this.args=c;d&&this.main(d);this.clear()};r.prototype.catalogPackages=function(a){return this.loader.catalogPackages(a)};r.prototype.createRequire=function(a){var b=this,c=a.id,d=a.ownerPackage,l=function(m,z){if(z&&m.indexOf(":")<0){if(z.isPackage)z=z.id;m=z+":"+m}return b.require(m,c,d)};a=l.displayName=(c||"(unknown)")+"#require";l.nativeRequire=b.nativeRequire;l.ensure=function(m,z){if(!h(m)){m=Array.prototype.slice.call(arguments);z=m.pop()}f(m,function(D,H){b.ensure(D,c,d,H)})(function(D){if(D)return z(D);
-if(z.length<=1)return z();z(null,g(m,function(H){return b.require(H,c,d)}))})};l.ensure.displayName=a+".ensure";l.ready=function(m){var z,D;h(m)||(m=Array.prototype.slice.call(arguments));D=m.length;for(z=0;z<D;z++)if(!b.ready(m[z],c,d))return false;return true};l.ready.displayName=a+".ready";l.packageFor=function(m,z){return b.packageFor(m,z,d)};l.packageFor.displayName=a+".packageFor";l.ensurePackage=function(m,z,D){b.ensurePackage(m,z,d,function(H){if(H)return D(H);if(D.length<=1)return D();D(null,
-b.packageFor(m,z,d))})};l.ensurePackage.displayName=a+".ensurePackage.displayName";l.catalogPackages=function(){return b.catalogPackages(d)};l.main=b.main();l.env=b.env;l.args=b.args;l.sandbox=b;l.loader=b.loader;l.isTiki=true;return l};r.prototype.Module=S;r.prototype.module=function(a,b,c){var d,l,m;b=this.loader.canonical(a,b,c);if(!b)throw new u(a,c);d=this.modules;if(!d)d=this.modules={};if(a=d[b])return a;l=b.indexOf(":",2);a=b.slice(l+1);l=b.slice(0,l);m=this.loader.packageFor(l,c);if(!m)throw new u(l,
-c);return a=d[b]=new this.Module(a,m,this)};r.prototype.main=function(a,b){if(a!==undefined){this._mainModule=null;this._mainModuleId=a;this._mainModuleWorkingPackage=b;return this}else{if(!this._mainModule&&this._mainModuleId){b=this._mainModuleWorkingPackage;this._mainModule=this.module(this._mainModuleId,b)}return this._mainModule}};r.prototype.require=function(a,b,c){var d,l;b=this.loader.canonical(a,b,c);if(!b)throw new u(a,c);l=this.exports;a=this.usedExports;if(!l)l=this.exports={};if(!a)a=
-this.usedExports={};if(d=l[b]){d=d.exports;a[b]||(a[b]=d);return d}d=this.loader.load(b,c,this);if(!d)throw new u(b,c);c=this.module(b,c);l[b]=c;l=d.call(this,c);c.exports=l;if(a[b]&&a[b]!==l)throw new Error("cyclical requires() in "+b);return l};r.prototype.ready=function(a,b,c){return(a=this.loader.canonical(a,b,c))?this.loader.ready(a):false};r.prototype.ensure=function(a,b,c,d){var l,m,z;if(b&&"string"!==typeof b){d=c;c=b;b=null}if(c&&"function"===typeof c){d=c;c=null}b=this.loader.canonical(a,
-b,c);if(!b)return d(new u(a,c));z=b.indexOf(":",2);a=b.slice(z+1);m=b.slice(0,z);l=this.loader;l.ensurePackage(m,c,function(D){if(D)return d(D);D=l.packageFor(m,c);D.exists(a)?d():d(new u(a,D))})};r.prototype.packageFor=function(a,b,c){a=this.loader.canonicalPackageId(a,b,c);if(!a)return null;return this.loader.packageFor(a)};r.prototype.ensurePackage=function(a,b,c,d){if(b&&"string"!==typeof b){d=c;c=b;b=null}if(c&&"function"===typeof c){d=c;c=null}b=this.loader.canonicalPackageId(a,b,c);if(!b)return d(new u(a,
-c));this.loader.ensurePackage(b,d)};r.prototype.resource=function(a,b,c){if(!c.resource)return null;return c.resource(a,b)};r.prototype.clear=function(){this.exports={};this.modules={};this.usedExports={};return this};var q=x.extend(Object);x.Browser=q;q.prototype.init=function(){this._ready={};this._unload={};this.clear()};q.prototype.clear=function(){this.packageInfoByName={};this.packageInfoById={};this.packages={};this.factories={};this.stylesheetActions={};this.scriptActions={};this.ensureActions=
-{}};q.start=function(a,b,c){var d;d=new q;d.loader=new k([d]);d.sandbox=new r(d.loader,a,b);d.queue=c;d.require=d.sandbox.createRequire({id:"index",ownerPackage:d.loader.anonymousPackage});return d};q.prototype.replay=function(){var a=this.queue,b=a?a.length:0,c,d;this.queue=null;for(c=0;c<b;c++){d=a[c];this[d.m].apply(this,d.a)}return this};q.prototype.start=function(){return this};q.prototype.global=function(a){if(!P&&!X)return this;var b=function(){return this}(),c,d,l,m,z,D,H,M;c=this.globals;
-if(!c)c=this.globals={};d=this.packageFor(a);if(!d)throw new Error(a+" package not found");l=d.get("dependencies");if(!l)return this;for(m in l)if(l.hasOwnProperty(m)){a=this.loader.canonical(m,d);if(!c[a]){c[a]=true;if(this.sandbox.ready(m,d)){a=this.sandbox.require(m,d);if(z=a.__globals__){M=z.length;for(H=0;H<M;H++){D=z[H];b[D]=a[D]}}else for(D in a)if(a.hasOwnProperty(D))b[D]=a[D]}}}return this};var G=function(a){var b,c;if(a.length===1){b=null;c=a[0];a=Array.prototype.slice.call(a,1)}else{b=
-a[0];c=a[1];a=Array.prototype.slice.call(a,2)}return{target:b,method:c,args:a}},K=function(a,b,c){a[b]||(a[b]=[]);a[b].push(G(c))};q.prototype.addReadyListener=function(){if(this._ready&&this._ready.isReady)this._invoke(G(arguments));else{this._setupReadyListener();K(this._ready,"queue",arguments)}};q.prototype.addMainListener=function(){if(this._ready&&this._ready.isReady)this._invoke(G(arguments));else{this._setupReadyListener();K(this._ready,"mqueue",arguments)}};q.prototype.addUnloadListener=
-function(){if(this._unload&&this._unload.isUnloading)this._invoke(G(arguments));else{this._setupUnloadListener();K(this._unload,"queue",arguments)}};q.prototype._invoke=function(a){var b=a.target,c=a.method;if("string"===typeof b)b=this.require(b);if("string"===typeof c)c=b[c];c&&c.apply(b,a.args);a.target=a.method=a.args=null};q.prototype._setupReadyListener=function(){if(this._ready.setup)return this;this._ready.setup=true;var a=this._ready,b=this,c;c=function(){if(!a.isReady){a.isReady=true;a.cleanup&&
-a.cleanup();a.cleanup=null;var d,l,m;l=(d=a.queue)?d.length:0;a.queue=null;for(m=0;m<l;m++)b._invoke(d[m]);l=(d=a.mqueue)?d.length:0;a.mqueue=null;for(m=0;m<l;m++)b._invoke(d[m]);b._runMain()}};if("undefined"!==typeof document)if(document.addEventListener){a.cleanup=function(){document.removeEventListener("DOMContentLoaded",c,false);document.removeEventListener("load",c,false)};document.addEventListener("DOMContentLoaded",c,false);document.addEventListener("load",c,false)}else if(document.attachEvent){a.cleanup=
-function(){document.detachEvent("onreadystatechange",c);document.detachEvent("onload",c);a.ieHandler=null};document.attachEvent("onreadystatechange",c);document.attachEvent("onload",c);if(document.documentElement.doScroll&&window==window.top){a.ieHandler=function(){if(a.ieHandler&&!a.isReady)try{document.documentElement.doScroll("left")}catch(d){setTimeout(a.ieHandler,0);return}c()};a.ieHandler()}}};q._scheduleUnloadListener=function(){if(this._unload.setup)return this;this._unload.setup=true;var a=
-this._unload,b=this,c;a.isUnloading=false;c=function(){if(!a.isUnloading){a.isUnloading=true;a.cleanup&&a.cleanup();a.cleanup=null;var d=a.queue,l=d?d.length:0,m;a.queue=null;for(m=0;m<l;m++)b._invoke(d[m])}};if("undefined"!==typeof document)if(document.addEventListener){a.cleanup=function(){document.removeEventListener("unload",c)};document.addEventListener("unload",c,false)}else if(document.attachEvent){a.cleanup=function(){document.detachEvent("onunload",c)};document.attachEvent("unload",c)}};
-q.prototype.main=function(a,b){this.sandbox&&this.sandbox.main(a);this._setupReadyListener();this._main={id:a,method:b}};q.prototype._runMain=function(){if(this._main){var a=this._main.id,b=this._main.method,c=this.require;if(a&&c){this._main=null;c.ensure(a,function(d){if(d)throw d;d=c(a);if("string"===typeof b)b=d[b];b&&b.call(d)})}}};q.prototype._action=function(a){var b;return b=n(function(c){b.resolve=function(d,l){b.resolve=null;c(d,l)};a()})};q.prototype._resolve=function(a,b,c){if(a[b])a[b].resolve&&
-a[b].resolve(null,c);else a[b]=function(d){d(null,c)};return this};q.prototype._fail=function(a,b,c){a[b].resolve&&a[b].resolve(c)};q.prototype._normalize=function(a,b){w(b)||(b="::"+b);a.id=b;a.version=J.normalize(a.version);a["tiki:external"]=!!a["tiki:external"];a["tiki:private"]=!!a["tiki:private"];var c=a["tiki:base"];if(a["tiki:resources"])a["tiki:resources"]=g(a["tiki:resources"],function(m){if("string"===typeof m)m={id:b+":"+m,name:m};if(!m.name)throw new A(a,"resources must have a name");
-if(!m.id)m.id=b+":"+m.name;if(!w(m.id))m.id="::"+m.id;if(!m.type)m.type=m.name.match(/\.js$/)?"script":m.name.match(/\.css$/)?"stylesheet":"resource";if(!m.url)m.url=c?c+"/"+m.name:m.id+m.name;return m});if(!a.dependencies)a.dependencies={};var d=a["tiki:nested"],l;if(d)for(l in d){if(d.hasOwnProperty(l))w(d[l])||(d[l]="::"+d[l])}else a["tiki:nested"]={};return a};q.prototype.register=function(a,b){var c,d,l,m=-1;b=this._normalize(b,a);a=b.id;c=this.packageInfoById;if(!c)c=this.packageInfoById={};
-if(c[a]){if(!c[a]["tiki:external"])return this;d=c[a]}c[a]=b;if(b.name){a=b.name;l=b.version;c=this.packageInfoByName;if(!c)c=this.packageInfoByName={};c[a]||(c[a]={});c=c[a];if(!c[l]||c[l].length<=1)c[l]=[b];else{if(d)m=c[l].indexOf(d);if(m>=0)c[l]=c[l].slice(0,m).concat(c[l].slice(m+1));c[l].push(b)}}return this};q.prototype.module=function(a,b){w(a)||(a="::"+a);this.factories[a]=b;return this};q.prototype.script=function(a){w(a)||(a="::"+a);this._resolve(this.scriptActions,a,true)};q.prototype.stylesheet=
-function(a){w(a)||(a="::"+a);this._resolve(this.stylesheetActions,a,true)};var P="undefined"!==typeof document&&document.createElement,X="undefined"!==typeof XMLHttpRequest;q.prototype.xhr=!P;q.prototype.autowrap=false;var Z=function(a){if(!a)return null;for(var b=a.length;--b>=0;)if(!a[b]["tiki:private"])return a[b];return null};q.prototype.canonicalPackageId=function(a,b){a=this.packageInfoByName[a];var c,d,l;if(b)b=J.normalize(b);if(!a)return null;if(a[b]&&a[b].length===1)return a[b][0].id;for(d in a)if(a.hasOwnProperty(d))if(J.compatible(b,
-d))if(!c||J.compare(l,d)<0)if(c=Z(a[d]))l=d;return c?c.id:null};q.prototype.packageFor=function(a){var b=this.packages[a];if(b)return b;if((b=this.packageInfoById[a])&&!b["tiki:external"]){b=new this.Package(a,b,this);return this.packages[a]=b}return null};q.prototype.ensurePackage=function(a,b){var c=this.ensureActions[a];if(c)return c(b);var d=this.packageInfoById[a];if(!d)return b(new u(a,"browser package info"));var l=this;c=n(function(m){var z=1,D=false,H,M=function(Y){if(!H){if(Y){H=true;return m(Y)}z-=
-1;if(z<=0&&D)return m(null,d)}},O=d.dependencies,W=d["tiki:nested"],V,T;for(V in O)if(O.hasOwnProperty(V)){T=W[V];if(!T){T=O[V];T=l.canonicalPackageId(V,T)}if(T&&l.packageInfoById[a]){z++;l.ensurePackage(T,M)}}W=(O=d["tiki:resources"])?O.length:0;for(V=0;V<W;V++){T=O[V];if(T.type!=="resource")if(T.type==="script"){z++;l.ensureScript(T.id,T.url,M)}else if(T.type==="stylesheet"){z++;l.ensureStylesheet(T.id,T.url,M)}}D=true;M()});this.ensureActions[a]=c;c(b)};q.prototype.ensureScript=function(a,b,c){var d=
-this.scriptActions[a];if(d)return d(c);var l=this;d=this._action(function(){l._loadScript(a,b)});this.scriptActions[a]=d;return d(c)};q.prototype.ensureStylesheet=function(a,b,c){var d=this.stylesheetActions[a];if(d)return d(c);var l=this;d=this._action(function(){l._loadStylesheet(a,b)});this.stylesheetActions[a]=d;return d(c)};q.prototype._injectScript=function(a,b){var c;a=document.body;c=document.createElement("script");c.src=b;a.appendChild(c)};q.prototype._xhrScript=function(a,b){var c=this.autowrap,
-d=new XMLHttpRequest;d.open("GET",b,true);d.onreadystatechange=function(){if(!(d.readyState!==4||d.status!==200&&d.status!==0)){var l=d.responseText;if(c)l="tiki.module('"+a+"', function(require, exports, module) {"+l+"});tiki.script('"+a+"');";eval(l+"\n//@ sourceURL="+b)}};d.send(null)};q.prototype._loadScript=function(a,b){if(this.autowrap){this.xhr=true;X||t("Autowrap is on but XHR is not available. Danger ahead.")}if(X&&P)if(this.xhr)try{return this._xhrScript(a,b)}catch(c){return this._injectScript(a,
-b)}else try{return this._injectScript(a,b)}catch(d){return this._xhrScript(a,b)}else if(X)return this._xhrScript(a,b);else if(P)return this._injectScript(a,b);t("Browser#_loadScript() not supported on this platform.");this.script(a)};q.prototype._loadStylesheet=P?function(a,b){var c,d;c=document.getElementsByTagName("head")[0]||document.body;d=document.createElement("link");d.rel="stylesheet";d.href=b;d.type="text/css";c.appendChild(d);this.stylesheet(a)}:function(a){t("Browser#_loadStylesheet() not supported on this platform.");
-this.stylesheet(a)};S=Q.extend();q.prototype.Package=S;S.prototype.init=function(a,b,c){Q.prototype.init.call(this,a,b);this.source=c};S.prototype.canonicalPackageId=function(a,b){var c;if(c=Q.prototype.canonicalPackageId.call(this,a,b))return c;c=(this.get("tiki:nested")||{})[a];if(!c)return null;return(a=this.source.packageInfoById[c])&&J.compatible(b,a.version)?c:null};S.prototype.packageFor=function(a){var b=Q.prototype.packageFor.call(this,a);return b?b:this.source.packageFor(a)};S.prototype.ensurePackage=
-function(a,b){if(a===this.id)return b();this.source.ensurePackage(a,b)};S.prototype.catalogPackages=function(){var a=[this],b,c;b=this.get("tiki:nested")||{};for(c in b)b.hasOwnProperty(c)&&a.push(this.source.packageFor(b[c]));return a};S.prototype.exists=function(a){return!!this.source.factories[this.id+":"+a]};S.prototype.load=function(a){var b;return(b=this.source.factories[this.id+":"+a])?new this.Factory(a,this,b):null};S.prototype.Factory=U;p(x,"tiki")});y=y.start();y.replay();bespin.tiki=y})();
-bespin.tiki.register("::bespin",{name:"bespin",dependencies:{}});bespin.bootLoaded=true;
-bespin.tiki.module("bespin:builtins",function(y,j){j.metadata={bespin:{provides:[{ep:"extensionpoint",name:"extensionpoint",indexOx:"name",register:"plugins#registerExtensionPoint",unregister:"plugins#unregisterExtensionPoint",description:"Defines a new extension point",params:[{name:"name",type:"string",description:"the extension point's name",required:true},{name:"description",type:"string",description:"description of what the extension point is for"},{name:"params",type:"array of objects",description:"parameters that provide the metadata for a given extension. Each object should have name and description, minimally. It can also have a 'type' (eg string, pointer, or array) and required to denote whether or not this parameter must be present on the extension."},
-{name:"indexOn",type:"string",description:"You can provide an 'indexOn' property to name a property of extensions through which you'd like to be able to easily look up the extension."},{name:"register",type:"pointer",description:"function that is called when a new extension is discovered. Note that this should be used sparingly, because it will cause your plugin to be loaded whenever a matching plugin appears."},{name:"unregister",type:"pointer",description:"function that is called when an extension is removed. Note that this should be used sparingly, because it will cause your plugin to be loaded whenever a matching plugin appears."}]},
-{ep:"extensionpoint",name:"extensionhandler",register:"plugins#registerExtensionHandler",unregister:"plugins#unregisterExtensionHandler",description:"Used to attach listeners ",params:[{name:"name",type:"string",description:"name of the extension point to listen to",required:true},{name:"register",type:"pointer",description:"function that is called when a new extension is discovered. Note that this should be used sparingly, because it will cause your plugin to be loaded whenever a matching plugin appears."},
-{name:"unregister",type:"pointer",description:"function that is called when an extension is removed. Note that this should be used sparingly, because it will cause your plugin to be loaded whenever a matching plugin appears."}]},{ep:"extensionpoint",name:"factory",description:"Provides a factory for singleton components. Each extension needs to provide a name, a pointer and an action. The action can be 'call' (if the pointer refers to a function), 'new' (if the pointer refers to a traditional JS object) or 'value' (if the pointer refers to the object itself that is the component).",
-indexOn:"name"},{ep:"factory",name:"hub",action:"create",pointer:"util/hub#Hub"},{ep:"extensionpoint",name:"command",description:"Editor commands/actions. TODO: list parameters here."}]}}});
-bespin.tiki.module("bespin:console",function(y,j){y=y("util/util");var x=function(){},E=["assert","count","debug","dir","dirxml","error","group","groupEnd","info","log","profile","profileEnd","time","timeEnd","trace","warn"];if(typeof window==="undefined"){var w={};E.forEach(function(t){w[t]=function(){var h=Array.prototype.slice.call(arguments);postMessage(JSON.stringify({op:"log",method:t,args:h}))}});j.console=w}else if(y.isSafari||y.isChrome)j.console=window.console;else{j.console={};E.forEach(function(t){j.console[t]=
-window.console&&window.console[t]?window.console[t]:x})}});
-bespin.tiki.module("bespin:globals",function(){if(!Object.defineProperty)Object.defineProperty=function(y,j,x){var E=Object.prototype.hasOwnProperty;if(typeof x=="object"&&y.__defineGetter__){if(E.call(x,"value")){if(!y.__lookupGetter__(j)&&!y.__lookupSetter__(j))y[j]=x.value;if(E.call(x,"get")||E.call(x,"set"))throw new TypeError("Object doesn't support this action");}else typeof x.get=="function"&&y.__defineGetter__(j,x.get);typeof x.set=="function"&&y.__defineSetter__(j,x.set)}return y};if(!Object.defineProperties)Object.defineProperties=
-function(y,j){for(var x in j)Object.prototype.hasOwnProperty.call(j,x)&&Object.defineProperty(y,x,j[x]);return y};(function(){if(!Array.isArray)Array.isArray=function(y){return y&&Object.prototype.toString.call(y)=="[object Array]"};if(!Object.keys)Object.keys=function(y){var j,x=[];for(j in y)y.hasOwnProperty(j)&&x.push(j);return x};if(!Function.prototype.bind)Function.prototype.bind=function(){var y=Array.prototype.slice.call(arguments),j=this,x=function(){return j.call.apply(j,y.concat(Array.prototype.slice.call(arguments)))};
-x.name=this.name;x.displayName=this.displayName;x.length=this.length;x.unbound=j;return x}})()});bespin.tiki.module("bespin:index",function(y,j){j.versionNumber="0.9a1";j.versionCodename="Edison";j.apiVersion="4"});
-bespin.tiki.module("bespin:plugins",function(y,j){y("globals");var x=y("promise").Promise,E=y("promise").group,w=y("builtins"),t=y("console").console,h=y("util/util");y("util/stacktrace");var o=y("proxy"),s=y.loader.sources[0],C=function(f,g){if(g){g=g.split("#");return{modName:g[0]?f+":"+g[0]:f,objName:g[1]}}},v=function(f){var g=y(f.modName);if(f.objName)return g[f.objName];return g};j.Extension=function(f){this.pluginName=null;for(property in f)if(f.hasOwnProperty(property))this[property]=f[property];
-this._observers=[]};j.Extension.prototype={load:function(f,g,n){n=n||j.catalog;var p=new x,u=function(I){f&&f(I);p.resolve(I)};g=this[g||"pointer"];if(h.isFunction(g)){u(g);return p}var A=C(this.pluginName,g);if(!A){t.error("Extension cannot be loaded because it has no 'pointer'");t.log(this);p.reject(new Error("Extension has no 'pointer' to call"));return p}var L=this.pluginName;n.loadPlugin(L).then(function(){y.ensure(A.modName,function(){var I=v(A);u(I)})},function(I){t.error("Failed to load plugin ",
-L,I)});return p},observe:function(f,g,n){this._observers.push({plugin:f,callback:g,property:n});this.load(g,n)},getPluginName:function(){return this.pluginName},_getLoaded:function(f){f=this._getPointer(f);return v(f)}};j.ExtensionPoint=function(f,g){this.name=f;this.catalog=g;this.indexOn=this.pluginName=undefined;this.extensions=[];this.handlers=[]};j.ExtensionPoint.prototype={getImplementingPlugins:function(){var f={};this.extensions.forEach(function(n){f[n.pluginName]=true});var g=Object.keys(f);
-g.sort();return g},getDefiningPluginName:function(){return this.pluginName},getByKey:function(f){var g=this.indexOn;if(g)for(var n=0;n<this.extensions.length;n++)if(this.extensions[n][g]==f)return this.extensions[n]},register:function(f){var g=this.catalog;this.extensions.push(f);this.handlers.forEach(function(n){n.register&&n.load(function(p){p?p(f,g):t.error("missing register function for pluginName=",f.pluginName,", extension=",f.name)},"register",g)})},unregister:function(f){var g=this.catalog;
-this.extensions.splice(this.extensions.indexOf(f),1);this.handlers.forEach(function(n){n.unregister&&n.load(function(p){p?p(f,g):t.error("missing unregister function for pluginName=",f.pluginName,", extension=",f.name)},"unregister",g)})},orderExtensions:function(f){for(var g=[],n=0;n<f.length;n++)for(var p=0;p!=this.extensions.length;)if(this.extensions[p].pluginName===f[n]){g.push(this.extensions[p]);this.extensions.splice(p,1)}else p++;this.extensions=g.concat(this.extensions)}};j.Plugin=function(f){this.name=
-this.catalog=null;this.provides=[];this.stylesheets=[];this.reloadPointer=this.reloadURL=null;for(property in f)if(f.hasOwnProperty(property))this[property]=f[property]};j.Plugin.prototype={register:function(){this.provides.forEach(function(f){this.catalog.getExtensionPoint(f.ep,true).register(f)},this)},unregister:function(){this.provides.forEach(function(f){this.catalog.getExtensionPoint(f.ep,true).unregister(f)},this)},_getObservers:function(){var f={};this.provides.forEach(function(g){t.log("ep: ",
-g.ep);t.log(g._observers);f[g.ep]=g._observers});return f},_findDependents:function(f,g,n){var p=this.name,u=this;f.forEach(function(A){if(A!=p){var L=u.catalog.plugins[A];if(L&&L.dependencies)for(dependName in L.dependencies)if(dependName==p&&!g[A]){g[A]={keepModule:false};n||L._findDependents(f,g)}}})},_cleanup:function(f){this.stylesheets.forEach(function(L){for(var I=document.getElementsByTagName("link"),N=0;N<I.length;N++)if(I[N].href.indexOf(L.url)!=-1){I[N].parentNode.removeChild(I[N]);break}});
-var g=this.name,n=new RegExp("^"+g+"$"),p=new RegExp("^::"+g+":");g=new RegExp("^::"+g+"$");var u=y.sandbox,A=y.loader;if(!f){F(p,A.factories);F(g,A.canonicalIds);F(g,A.canonicalPackageIds);F(g,A.packageSources);F(g,A.packages);F(n,s.packageInfoByName);F(p,s.factories);F(p,s.scriptActions);F(p,s.stylesheetActions);F(g,s.packages);F(g,s.ensureActions);F(g,s.packageInfoById)}F(p,u.exports);F(p,u.modules);F(p,u.usedExports)},reload:function(f){if(this.reloadURL){if(this.reloadPointer){var g=C(this.name,
-this.reloadPointer);if(func=v(g))func();else{t.error("Reload function could not be loaded. Aborting reload.");return}}var n={};this._findDependents(Object.keys(this.catalog.plugins),n);var p={pluginName:this.name,dependents:n};for(var u in n){g=this.catalog.plugins[u];if(g.preRefresh){g=C(u,g.preRefresh);if(func=v(g))n[u]=func(p)}}this.unregister();for(u in n)this.catalog.plugins[u].unregister();this._cleanup(this.name);g=[];var A=y.sandbox,L=Object.keys(A.modules),I=L.length,N=[];for(u in n)n[u].keepModule||
-N.push(new RegExp("^::"+u+":"));for(var i=new RegExp("^::"+this.name+":");--I>=0;){var J=L[I];if(i.exec(J))g.push(J);else for(var U=N.length;--U>=0;)if(N[U].exec(J)){g.push(J);break}}g.forEach(function(R){delete A.exports[R];delete A.modules[R];delete A.usedExports[R]});g=function(){this.catalog.loadPlugin(this.name).then(function(){for(u in n)this.catalog.plugins[u].register();for(u in n)if(n[u].callPointer){var R=C(u,n[u].callPointer);(R=v(R))&&R(p)}f&&f()}.bind(this))}.bind(this);L=function(){t.error("Failed to load metadata from "+
-this.reloadURL)}.bind(this);this.catalog.loadMetadataFromURL(this.reloadURL).then(g,L)}}};var B=function(f,g,n){g=g.split(".");f=f;var p=g.length-1;if(p>0)for(var u=0;u<p;u++)f=f[g[u]];f[p]=n};j.Catalog=function(){this.points={};this.plugins={};this.metadata={};this.USER_DEACTIVATED="USER";this.DEPENDS_DEACTIVATED="DEPENDS";this.deactivatedPlugins={};this._extensionsOrdering=[];this.instances={};this.instancesLoadPromises={};this._objectDescriptors={};this.children=[];this.getExtensionPoint("extensionpoint",
-true).indexOn="name";this.registerMetadata(w.metadata)};j.Catalog.prototype={shareExtension:function(f){return this.plugins[f.pluginName].share},isPluginLoaded:function(f){return Object.keys(y.sandbox.usedExports).some(function(g){return g.indexOf("::"+f+":")==0})},registerObject:function(f,g){this._objectDescriptors[f]=g},_setObject:function(f,g){this.instances[f]=g},createObject:function(f){if(this.instancesLoadPromises[f]!==undefined)return this.instancesLoadPromises[f];var g=this._objectDescriptors[f];
-if(g===undefined)throw new Error('Tried to create object "'+f+'" but that object is not registered.');var n=g.factory||f,p=this.getExtensionByKey("factory",n);if(p===undefined)throw new Error('When creating object "'+f+'", there is no factory called "'+n+'" available."');if(this.parent&&this.shareExtension(p))return this.instancesLoadPromises[f]=this.parent.createObject(f);var u=this.instancesLoadPromises[f]=new x,A=g.arguments||[];n=[];if(g.objects){g=g.objects;for(var L in g){var I=this.createObject(g[L]);
-n.push(I);I.location=L;I.then(function(N){B(A,I.location,N)})}}E(n).then(function(){p.load().then(function(N){var i=p.action;if(i==="call")N=N.apply(N,A);else if(i==="new"){if(A.length>1){u.reject(new Error("For object "+f+", create a simple factory function and change the action to call because JS cannot handle this case."));return}N=new N(A[0])}else if(i==="value")N=N;else{u.reject(new Error("Create action must be call|new|value. Found"+i));return}this.instances[f]=N;u.resolve(N)}.bind(this))}.bind(this));
-return u},getObject:function(f){return this.instances[f]||(this.parent?this.parent.getObject(f):undefined)},getExtensionPoint:function(f,g){if(g&&this.points[f]===undefined)this.points[f]=new j.ExtensionPoint(f,this);return this.points[f]},getExtensions:function(f){f=this.getExtensionPoint(f);if(f===undefined)return[];return f.extensions},orderExtensions:function(f){f=f||this._extensionsOrdering;for(name in this.points)this.points[name].orderExtensions(f);this._extensionsOrdering=f},getExtensionsOrdering:function(){return this._extensionsOrdering},
-getExtensionByKey:function(f,g){f=this.getExtensionPoint(f);if(f!==undefined)return f.getByKey(g)},_toposort:function(f){var g=[],n={},p=function(A){if(!(A in n||!(A in f))){n[A]=true;var L=f[A].dependencies;if(!h.none(L))for(var I in L)p(I);g.push(A)}};for(var u in f)p(u);return g},registerMetadata:function(f){if(this.parent)this.parent.registerMetadata(f);else{for(var g in f){var n=f[g];if(n.errors){t.error("Plugin ",g," has errors:");n.errors.forEach(function(p){t.error(p)});delete f[g]}else{if(n.dependencies)n.depends=
-Object.keys(n.dependencies);n.name=g;n.version=null;s.canonicalPackageId(g)===null&&s.register("::"+g,n)}}h.mixin(this.metadata,h.clone(f,true));this.children.forEach(function(p){p._registerMetadata(h.clone(f,true))});this._registerMetadata(h.clone(f,true))}},_registerMetadata:function(f){var g,n=this.plugins;this._toposort(f).forEach(function(p){if(this.plugins[p])if(this.isPluginLoaded(p))return;else{var u=this.plugins[p];u.unregister()}var A=f[p],L=!this.deactivatedPlugins[p];if(L&&A.depends&&
-A.depends.length!=0)if(!A.depends.some(function(i){return!this.deactivatedPlugins[i]},this)){this.deactivatedPlugins[p]="DEPENDS";L=false}A.catalog=this;A.name=p;u=new j.Plugin(A);n[p]=u;if(A.provides){u=A.provides;for(A=0;A<u.length;A++){var I=new j.Extension(u[A]);I.pluginName=p;u[A]=I;var N=I.ep;if(N=="extensionpoint"&&I.name=="extensionpoint")j.registerExtensionPoint(I,this,false);else if(L)this.getExtensionPoint(I.ep,true).register(I);else N=="extensionpoint"&&j.registerExtensionPoint(I,this,
-true)}}else A.provides=[]},this);for(g in f)this._checkLoops(g,n,[]);this.orderExtensions()},loadPlugin:function(f){var g=new x,n=this.plugins[f];if(n.objects){var p=[];n.objects.forEach(function(u){p.push(this.createObject(u))}.bind(this));E(p).then(function(){y.ensurePackage(f,function(){g.resolve()})})}else y.ensurePackage(f,function(u){u?g.reject(u):g.resolve()});return g},loadMetadataFromURL:function(f){var g=new x;o.xhr("GET",f,true).then(function(n){this.registerMetadata(JSON.parse(n));g.resolve()}.bind(this),
-function(n){g.reject(n)});return g},deactivatePlugin:function(f,g){var n=this.plugins[f];if(!n){g||(this.deactivatedPlugins[f]="USER");return'There is no plugin named "'+f+'" in this catalog.'}if(this.deactivatedPlugins[f]){g||(this.deactivatedPlugins[f]="USER");return'The plugin "'+f+'" is already deactivated'}this.deactivatedPlugins[f]=g?"DEPENDS":"USER";var p={},u=[];n._findDependents(Object.keys(this.plugins),p,true);Object.keys(p).forEach(function(A){A=this.deactivatePlugin(A,true);if(Array.isArray(A))u=
-u.concat(A)},this);n.unregister();g&&u.push(f);return u},activatePlugin:function(f,g){var n=this.plugins[f];if(!n)return'There is no plugin named "'+f+'" in this catalog.';if(!this.deactivatedPlugins[f])return'The plugin "'+f+'" is already activated';if(!(g&&this.deactivatedPlugins[f]==="USER")){if(n.depends&&n.depends.length!=0)if(!n.depends.some(function(A){return!this.deactivatedPlugins[A]},this)){this.deactivatedPlugins[f]="DEPENDS";return'Can not activate plugin "'+f+'" as some of its dependent plugins are not activated'}n.register();
-this.orderExtensions();delete this.deactivatedPlugins[f];var p=[],u={};n._findDependents(Object.keys(this.plugins),u,true);Object.keys(u).forEach(function(A){A=this.activatePlugin(A,true);if(Array.isArray(A))p=p.concat(A)},this);g&&p.push(f);return p}},removePlugin:function(f){var g=this.plugins[f];if(g==undefined)throw new Error("Attempted to remove plugin "+f+" which does not exist.");g.unregister();g._cleanup(true);delete this.metadata[f];delete this.plugins[f]},getResourceURL:function(f){var g=
-document.getElementById("bespin_base"),n="";if(g){n+=g.href;h.endsWith(n,"/")||(n+="/")}f=this.plugins[f];if(f!=undefined)return n+f.resourceURL},_checkLoops:function(f,g,n){var p=false;n.forEach(function(L){if(f===L){t.error("Circular dependency",f,n);p=true}});if(p)return true;n.push(f);if(g[f]){if(g[f].dependencies)for(var u in g[f].dependencies){var A=n.slice();if(this._checkLoops(u,g,A)){t.error("Errors found when looking at ",f);return true}}}else t.error("Missing metadata for ",f);return false},
-getPlugins:function(f){var g=[],n=f.onlyType;for(var p in this.plugins){var u=this.plugins[p];n&&u.type&&u.type!=n||u.name=="bespin"||g.push(u)}var A=f.sortBy;A||(A=["name"]);g.sort(function(L,I){for(var N=0;N<A.length;N++){p=A[N];if(L[p]<I[p])return-1;else if(I[p]<L[p])return 1}return 0});return g},loadObjectForPropertyPath:function(f,g){var n=new x,p=/^([^:]+):([^#]+)#(.*)$/.exec(f);if(p===null)throw new Error("loadObjectForPropertyPath: malformed path: '"+f+"'");p=p[1];if(p===""){if(h.none(g))throw new Error("loadObjectForPropertyPath: no plugin name supplied and no context is present");
-p=g}y.ensurePackage(p,function(){n.resolve(this.objectForPropertyPath(f))}.bind(this));return n},objectForPropertyPath:function(f,g,n){n=n==undefined?f.length:n;g||(g=window);var p=f.split("#");if(p.length!==1){g=y(p[0]);if(g===undefined)return;f=p[1];g=g;n-=p[0].length}for(var u=0;g&&u<n;){p=f.indexOf(".",u);if(p<0||p>n)p=n;u=f.slice(u,p);g=g[u];u=p+1}if(u<n)g=undefined;return g},publish:function(f,g,n,p){if(this.shareExtension(this.getExtensionPoint(g)))if(this.parent)this.parent.publish(f,g,n,
-p);else{this.children.forEach(function(u){u._publish(f,g,n,p)});this._publish(f,g,n,p)}else this._publish(f,g,n,p)},_publish:function(f,g,n,p){this.getExtensions(g).forEach(function(u){if(u.match&&!u.regexp)u.regexp=new RegExp(u.match);if(u.regexp&&u.regexp.test(n)||u.key===n||h.none(u.key)&&h.none(n))u.load().then(function(A){A(f,n,p)})})},registerExtension:function(f,g){g=new j.Extension(g);g.pluginName="__dynamic";this.getExtensionPoint(f).register(g)}};j.registerExtensionPoint=function(f,g,n){var p=
-g.getExtensionPoint(f.name,true);p.description=f.description;p.pluginName=f.pluginName;p.params=f.params;if(f.indexOn)p.indexOn=f.indexOn;if(!n&&(f.register||f.unregister))j.registerExtensionHandler(f,g)};j.registerExtensionHandler=function(f,g){if(!(g.parent&&g.shareExtension(f))){var n=g.getExtensionPoint(f.name,true);n.handlers.push(f);if(f.register){var p=h.clone(n.extensions);f.load(function(u){if(!u)throw f.name+" is not ready";p.forEach(function(A){u(A,g)})},"register",g)}}};j.unregisterExtensionPoint=
-function(f){if(f.register||f.unregister)j.unregisterExtensionHandler(f)};j.unregisterExtensionHandler=function(f,g){if(!(g.parent&&g.shareExtension(f))){g=g.getExtensionPoint(f.name,true);if(g.handlers.indexOf(f)!=-1){g.handlers.splice(g.handlers.indexOf(f),1);if(f.unregister){var n=h.clone(g.extensions);f.load(function(p){if(!p)throw f.name+" is not ready";n.forEach(function(u){p(u)})},"unregister")}}}};j.catalog=new j.Catalog;var F=function(f,g){for(var n=Object.keys(g),p=n.length;--p>0;)f.exec(n[p])&&
-delete g[n[p]]};j.getUserPlugins=function(){return j.catalog.getPlugins({onlyType:"user"})}});
-bespin.tiki.module("bespin:promise",function(y,j){var x=y("bespin:console").console;y("bespin:util/stacktrace");var E=0;j._outstanding=[];j._recent=[];j.Promise=function(){this._status=0;this._value=undefined;this._onSuccessHandlers=[];this._onErrorHandlers=[];this._id=E++;j._outstanding[this._id]=this};j.Promise.prototype.isPromise=true;j.Promise.prototype.isComplete=function(){return this._status!=0};j.Promise.prototype.isResolved=function(){return this._status==1};j.Promise.prototype.isRejected=
-function(){return this._status==-1};j.Promise.prototype.then=function(w,t){if(typeof w==="function")if(this._status===1)w.call(null,this._value);else this._status===0&&this._onSuccessHandlers.push(w);if(typeof t==="function")if(this._status===-1)t.call(null,this._value);else this._status===0&&this._onErrorHandlers.push(t);return this};j.Promise.prototype.chainPromise=function(w){var t=new j.Promise;t._chainedFrom=this;this.then(function(h){try{t.resolve(w(h))}catch(o){t.reject(o)}},function(h){t.reject(h)});
-return t};j.Promise.prototype.resolve=function(w){return this._complete(this._onSuccessHandlers,1,w,"resolve")};j.Promise.prototype.reject=function(w){return this._complete(this._onErrorHandlers,-1,w,"reject")};j.Promise.prototype._complete=function(w,t,h,o){if(this._status!=0){x.group("Promise already closed");x.error("Attempted "+o+"() with ",h);x.error("Previous status = ",this._status,", previous value = ",this._value);x.trace();if(this._completeTrace){x.error("Trace of previous completion:");
-this._completeTrace.log(5)}x.groupEnd();return this}this._status=t;this._value=h;w.forEach(function(s){s.call(null,this._value)},this);this._onSuccessHandlers.length=0;this._onErrorHandlers.length=0;delete j._outstanding[this._id];for(j._recent.push(this);j._recent.length>20;)j._recent.shift();return this};j.group=function(w){w instanceof Array||(w=Array.prototype.slice.call(arguments));if(w.length===0)return(new j.Promise).resolve([]);var t=new j.Promise,h=[],o=0,s=function(C){return function(v){h[C]=
-v;o++;t._status!==-1&&o===w.length&&t.resolve(h)}};w.forEach(function(C,v){v=s(v);var B=t.reject.bind(t);C.then(v,B)});return t}});
-bespin.tiki.module("bespin:proxy",function(y,j){y("util/util");var x=y("promise").Promise;j.xhr=function(E,w,t,h){var o=new x;if(!bespin.proxy||!bespin.proxy.xhr){var s=new XMLHttpRequest;s.onreadystatechange=function(){if(s.readyState===4){var C=s.status;if(C!==0&&C!==200){C=new Error(s.responseText+" (Status "+s.status+")");C.xhr=s;o.reject(C)}else o.resolve(s.responseText)}}.bind(this);s.open("GET",w,t);h&&h(s);s.send()}else bespin.proxy.xhr.call(this,E,w,t,h,o);return o};j.Worker=function(E){return!bespin.proxy||
-!bespin.proxy.worker?new Worker(E):new bespin.proxy.worker(E)}});
-bespin.tiki.module("bespin:sandbox",function(y,j){var x=y("tiki"),E=y("bespin:util/util"),w=y("bespin:plugins").catalog;if(w.parent)throw new Error("The sandbox module can't be used inside of a slave catalog!");y=function(){x.Sandbox.call(this,bespin.tiki.require.loader,{},[]);var t=this.require("bespin:plugins").catalog;t.parent=w;w.children.push(t);t.deactivatePlugin=E.clone(w.deactivatePlugin);t._extensionsOrdering=E.clone(w._extensionsOrdering);t._registerMetadata(E.clone(w.metadata,true))};y.prototype=
-new x.Sandbox;y.prototype.require=function(t,h,o){var s=this.loader.canonical(t,h,o).substring(2).split(":")[0];return w.plugins[s].share?bespin.tiki.sandbox.require(t,h,o):x.Sandbox.prototype.require.call(this,t,h,o)};j.Sandbox=y});
-bespin.tiki.module("bespin:util/cookie",function(y,j){var x=function(E,w){return E.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g,function(t){if(w&&w.indexOf(t)!=-1)return t;return"\\"+t})};j.get=function(E){E=new RegExp("(?:^|; )"+x(E)+"=([^;]*)");return(E=document.cookie.match(E))?decodeURIComponent(E[1]):undefined};j.set=function(E,w,t){t=t||{};if(typeof t.expires=="number"){var h=new Date;h.setTime(h.getTime()+t.expires*24*60*60*1E3);t.expires=h}if(t.expires&&t.expires.toUTCString)t.expires=t.expires.toUTCString();
-w=encodeURIComponent(w);E=E+"="+w;var o;for(o in t){E+="; "+o;w=t[o];if(w!==true)E+="="+w}document.cookie=E};j.remove=function(E){j.set(E,"",{expires:-1})};j.isSupported=function(){if(!("cookieEnabled"in navigator)){j.set("__djCookieTest__","CookiesAllowed");navigator.cookieEnabled=j.get("__djCookieTest__")=="CookiesAllowed";navigator.cookieEnabled&&j.remove("__djCookieTest__")}return navigator.cookieEnabled}});
-bespin.tiki.module("bespin:util/scratchcanvas",function(y,j){var x=y("bespin:util/util"),E=function(){this._canvas=document.getElementById("bespin-scratch-canvas");if(x.none(this._canvas)){this._canvas=document.createElement("canvas");this._canvas.id="bespin-scratch-canvas";this._canvas.width=400;this._canvas.height=300;this._canvas.style.position="absolute";this._canvas.style.top="-10000px";this._canvas.style.left="-10000px";document.body.appendChild(this._canvas)}};E.prototype.getContext=function(){return this._canvas.getContext("2d")};
-E.prototype.measureStringWidth=function(t,h){if(x.none(h))h="M";var o=this.getContext();o.save();o.font=t;t=o.measureText(h).width;o.restore();return t};var w=null;j.get=function(){if(w===null)w=new E;return w}});
-bespin.tiki.module("bespin:util/stacktrace",function(y,j){function x(v){for(var B=0;B<v.length;++B){var F=v[B];if(typeof F=="object")v[B]="#object";else if(typeof F=="function")v[B]="#function";else if(typeof F=="string")v[B]='"'+F+'"'}return v.join(",")}function E(){}var w=y("bespin:util/util"),t=y("bespin:console").console,h=function(){if(w.isMozilla)return"firefox";else if(w.isOpera)return"opera";else if(w.isSafari)return"other";try{0()}catch(v){if(v.arguments)return"chrome";if(v.stack)return"firefox";
-if(window.opera&&!("stacktrace"in v))return"opera"}return"other"}(),o={chrome:function(v){var B=v.stack;if(!B){t.log(v);return[]}return B.replace(/^.*?\n/,"").replace(/^.*?\n/,"").replace(/^.*?\n/,"").replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@").split("\n")},firefox:function(v){var B=v.stack;if(!B){t.log(v);return[]}B=B.replace(/(?:\n@:0)?\s+$/m,"");B=B.replace(/^\(/gm,"{anonymous}(");return B.split("\n")},opera:function(v){v=v.message.split("\n");
-var B=/Line\s+(\d+).*?script\s+(http\S+)(?:.*?in\s+function\s+(\S+))?/i,F,f,g;F=4;f=0;for(g=v.length;F<g;F+=2)if(B.test(v[F]))v[f++]=(RegExp.$3?RegExp.$3+"()@"+RegExp.$2+RegExp.$1:"{anonymous}()@"+RegExp.$2+":"+RegExp.$1)+" -- "+v[F+1].replace(/^\s+/,"");v.splice(f,v.length-f);return v},other:function(v){for(var B=/function\s*([\w\-$]+)?\s*\(/i,F=[],f=0,g,n;v&&F.length<10;){g=B.test(v.toString())?RegExp.$1||"{anonymous}":"{anonymous}";n=Array.prototype.slice.call(v.arguments);F[f++]=g+"("+x(n)+")";
-if(v===v.caller&&window.opera)break;v=v.caller}return F}};E.prototype={sourceCache:{},ajax:function(v){var B=this.createXMLHTTPObject();if(B){B.open("GET",v,false);B.setRequestHeader("User-Agent","XMLHTTP/1.0");B.send("");return B.responseText}},createXMLHTTPObject:function(){for(var v,B=[function(){return new XMLHttpRequest},function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Msxml3.XMLHTTP")},function(){return new ActiveXObject("Microsoft.XMLHTTP")}],F=0;F<
-B.length;F++)try{v=B[F]();this.createXMLHTTPObject=B[F];return v}catch(f){}},getSource:function(v){v in this.sourceCache||(this.sourceCache[v]=this.ajax(v).split("\n"));return this.sourceCache[v]},guessFunctions:function(v){for(var B=0;B<v.length;++B){var F=v[B],f=/{anonymous}\(.*\)@(\w+:\/\/([-\w\.]+)+(:\d+)?[^:]+):(\d+):?(\d+)?/.exec(F);if(f){var g=f[1];f=f[4];if(g&&f){g=this.guessFunctionName(g,f);v[B]=F.replace("{anonymous}",g)}}}return v},guessFunctionName:function(v,B){try{return this.guessFunctionNameFromLines(B,
-this.getSource(v))}catch(F){return"getSource failed with url: "+v+", exception: "+F.toString()}},guessFunctionNameFromLines:function(v,B){for(var F=/function ([^(]*)\(([^)]*)\)/,f=/['"]?([0-9A-Za-z_]+)['"]?\s*[:=]\s*(function|eval|new Function)/,g="",n=0;n<10;++n){g=B[v-n]+g;if(g!==undefined){var p=f.exec(g);if(p)return p[1];else p=F.exec(g);if(p&&p[1])return p[1]}}return"(?)"}};var s=new E,C=[/http:\/\/localhost:4020\/sproutcore.js:/];j.ignoreFramesMatching=function(v){C.push(v)};j.Trace=function(v,
-B){this._ex=v;this._stack=o[h](v);if(B)this._stack=s.guessFunctions(this._stack)};j.Trace.prototype.log=function(v){if(v<=0)v=999999999;for(var B=0,F=0;F<this._stack.length&&B<v;F++){var f=this._stack[F],g=true;C.forEach(function(n){if(n.test(f))g=false});if(g){t.debug(f);B++}}}});
-bespin.tiki.module("bespin:util/util",function(y,j){j.queryToObject=function(h,o){var s={};h=h.split(o||"&");var C=decodeURIComponent;h.forEach(function(v){if(v.length){var B=v.split("=");v=C(B.shift());B=C(B.join("="));if(j.isString(s[v]))s[v]=[s[v]];if(Array.isArray(s[v]))s[v].push(B);else s[v]=B}});return s};j.objectToQuery=function(h){var o=encodeURIComponent,s=[],C={};for(var v in h){var B=h[v];if(B!=C[v]){var F=o(v)+"=";if(B.isArray)for(var f=0;f<B.length;f++)s.push(F+o(B[f]));else s.push(F+
-o(B))}}return s.join("&")};var x=0,E={};j.rateLimit=function(h,o,s){if(h){var C=x++;return function(){E[C]&&clearTimeout(E[C]);E[C]=setTimeout(function(){s.apply(o,arguments);delete E[C]},h)}}};j.isString=function(h){return typeof h=="string"||h instanceof String};j.isBoolean=function(h){return typeof h=="boolean"};j.isNumber=function(h){return typeof h=="number"&&isFinite(h)};j.isObject=function(h){return h!==undefined&&(h===null||typeof h=="object"||Array.isArray(h)||j.isFunction(h))};j.isFunction=
-function(){var h=function(o){var s=typeof o;return o&&(s=="function"||o instanceof Function)&&!o.nodeType};return j.isSafari?function(o){if(typeof o=="function"&&o=="[object NodeList]")return false;return h(o)}:h}();j.endsWith=function(h,o){if(!h)return false;return h.match(new RegExp(o+"$"))};j.include=function(h,o){return h.indexOf(o)>-1};j.indexOfProperty=function(h,o,s){for(var C=0;C<h.length;C++)if(h[C][o]==s)return C;return null};j.last=function(h){if(Array.isArray(h))return h[h.length-1]};
-j.shrinkArray=function(h){var o=[],s=true;h.reverse().forEach(function(C){if(!(s&&C===undefined)){s=false;o.push(C)}});return o.reverse()};j.makeArray=function(h,o){if(h<1)return[];o||(o=" ");for(var s=[],C=0;C<h;C++)s.push(o);return s};j.repeatString=function(h,o){for(var s="",C=0;C<o;C++)s+=h;return s};j.leadingSpaces=function(h){for(var o=0,s=0;s<h.length;s++)if(h[s]==" "||h[s]==""||h[s]===undefined)o++;else return o;return o};j.leadingTabs=function(h){for(var o=0,s=0;s<h.length;s++)if(h[s]=="\t"||
-h[s]==""||h[s]===undefined)o++;else return o;return o};j.leadingWhitespace=function(h){for(var o=[],s=0;s<h.length;s++)if(h[s]==" "||h[s]=="\t"||h[s]==""||h[s]===undefined)o.push(h[s]);else return o;return o};j.englishFromCamel=function(h){h.replace(/([A-Z])/g,function(o){return" "+o.toLowerCase()}).trim()};j.OS={LINUX:"LINUX",MAC:"MAC",WINDOWS:"WINDOWS"};y=navigator.userAgent;var w=navigator.appVersion;j.isLinux=w.indexOf("Linux")>=0;j.isWindows=w.indexOf("Win")>=0;j.isWebKit=parseFloat(y.split("WebKit/")[1])||
-undefined;j.isChrome=parseFloat(y.split("Chrome/")[1])||undefined;j.isMac=w.indexOf("Macintosh")>=0;j.isMozilla=w.indexOf("Gecko/")>=0;if(y.indexOf("AdobeAIR")>=0)j.isAIR=1;var t=Math.max(w.indexOf("WebKit"),w.indexOf("Safari"),0);if(t&&!j.isChrome){j.isSafari=parseFloat(w.split("Version/")[1]);if(!j.isSafari||parseFloat(w.substr(t+7))<=419.3)j.isSafari=2}if(y.indexOf("Gecko")>=0&&!j.isWebKit)j.isMozilla=parseFloat(w);j.getOS=function(){return j.isMac?j.OS.MAC:j.isLinux?j.OS.LINUX:j.OS.WINDOWS};j.contains=
-typeof document!=="undefined"&&document.compareDocumentPosition?function(h,o){return h.compareDocumentPosition(o)&16}:function(h,o){return h!==o&&(h.contains?h.contains(o):true)};j.stopEvent=function(h){h.preventDefault();h.stopPropagation()};j.randomPassword=function(h){h=h||16;for(var o="",s=0;s<h;s++){var C=Math.floor(Math.random()*62);o+="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890".charAt(C)}return o};j.isEmpty=function(h){for(var o in h)if(h.hasOwnProperty(o))return false;
-return true};j.isMyProject=function(h){return h.indexOf("+")==-1};j.formatDate=function(h){if(!h)return"Unknown";return h.getDate()+" "+j.formatDate.shortMonths[h.getMonth()]+" "+h.getFullYear()};j.formatDate.shortMonths=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];j.addClass=function(h,o){o=o.split(/\s+/);for(var s=" "+h.className+" ",C=0,v=o.length,B;C<v;++C)if((B=o[C])&&s.indexOf(" "+B+" ")<0)s+=B+" ";h.className=s.trim()};j.removeClass=function(h,o){if(o!==undefined){var s=
-o.split(/\s+/);o=" "+h.className+" ";for(var C=0,v=s.length;C<v;++C)o=o.replace(" "+s[C]+" "," ");o=o.trim()}else o="";if(h.className!=o)h.className=o};j.setClass=function(h,o,s){s?j.addClass(h,o):j.removeClass(h,o)};j.none=function(h){return h===null||h===undefined};j.clone=function(h,o){if(Array.isArray(h)&&!o)return h.slice();if(typeof h==="object"||Array.isArray(h)){if(h===null)return null;var s=Array.isArray(h)?[]:{};for(var C in h)s[C]=o&&(typeof h[C]==="object"||Array.isArray(h[C]))?j.clone(h[C],
-true):h[C];return s}if(h.clone&&typeof h.clone==="function")return h.clone();return h};j.mixin=function(h,o){for(var s in o){var C=o.__lookupGetter__(s),v=o.__lookupSetter__(s);if(C||v){C&&h.__defineGetter__(s,C);v&&h.__defineSetter__(s,v)}else h[s]=o[s]}return h};j.replace=function(h,o,s,C){return h.slice(0,o).concat(C).concat(h.slice(o+s))};j.rectsEqual=function(h,o,s){if(!h||!o)return h==o;if(!s&&s!==0)s=0.1;if(h.y!=o.y&&Math.abs(h.y-o.y)>s)return false;if(h.x!=o.x&&Math.abs(h.x-o.x)>s)return false;
-if(h.width!=o.width&&Math.abs(h.width-o.width)>s)return false;if(h.height!=o.height&&Math.abs(h.height-o.height)>s)return false;return true}});bespin.tiki.register("::syntax_directory",{name:"syntax_directory",dependencies:{}});
-bespin.tiki.module("syntax_directory:index",function(y,j){function x(t){this.extension=t;this.name=t.name;this.fileExts=t.hasOwnProperty("fileexts")?t.fileexts:[]}function E(t){w.register(t)}y("bespin:plugins");var w={_fileExts:{},_syntaxInfo:{},get:function(t){return this._syntaxInfo[t]},hasSyntax:function(t){return this._syntaxInfo.hasOwnProperty(t)},register:function(t){var h=new x(t);this._syntaxInfo[h.name]=h;var o=this._fileExts;h.fileExts.forEach(function(s){o[s]=h.name})},syntaxForFileExt:function(t){t=
-t.toLowerCase();var h=this._fileExts;return h.hasOwnProperty(t)?h[t]:"plain"}};j.syntaxDirectory=w;j.discoveredNewSyntax=E});bespin.tiki.register("::underscore",{name:"underscore",dependencies:{}});
-bespin.tiki.module("underscore:index",function(y,j){(function(){var x=this,E=x._,w=typeof StopIteration!=="undefined"?StopIteration:"__break__",t=function(e){return e.replace(/([.*+?^${}()|[\]\/\\])/g,"\\$1")},h=Array.prototype,o=Object.prototype,s=h.slice,C=h.unshift,v=o.toString,B=o.hasOwnProperty,F=h.forEach,f=h.map,g=h.reduce,n=h.reduceRight,p=h.filter,u=h.every,A=h.some,L=h.indexOf,I=h.lastIndexOf;o=Array.isArray;var N=Object.keys,i=function(e){return new R(e)};if(typeof j!=="undefined")j._=
-i;x._=i;i.VERSION="1.0.2";var J=i.forEach=function(e,k,r){try{if(F&&e.forEach===F)e.forEach(k,r);else if(i.isNumber(e.length))for(var q=0,G=e.length;q<G;q++)k.call(r,e[q],q,e);else for(q in e)B.call(e,q)&&k.call(r,e[q],q,e)}catch(K){if(K!=w)throw K;}return e};i.map=function(e,k,r){if(f&&e.map===f)return e.map(k,r);var q=[];J(e,function(G,K,P){q.push(k.call(r,G,K,P))});return q};i.reduce=function(e,k,r,q){if(g&&e.reduce===g)return e.reduce(i.bind(r,q),k);J(e,function(G,K,P){k=r.call(q,k,G,K,P)});return k};
-i.reduceRight=function(e,k,r,q){if(n&&e.reduceRight===n)return e.reduceRight(i.bind(r,q),k);e=i.clone(i.toArray(e)).reverse();return i.reduce(e,k,r,q)};i.detect=function(e,k,r){var q;J(e,function(G,K,P){if(k.call(r,G,K,P)){q=G;i.breakLoop()}});return q};i.filter=function(e,k,r){if(p&&e.filter===p)return e.filter(k,r);var q=[];J(e,function(G,K,P){k.call(r,G,K,P)&&q.push(G)});return q};i.reject=function(e,k,r){var q=[];J(e,function(G,K,P){!k.call(r,G,K,P)&&q.push(G)});return q};i.every=function(e,k,
-r){k=k||i.identity;if(u&&e.every===u)return e.every(k,r);var q=true;J(e,function(G,K,P){(q=q&&k.call(r,G,K,P))||i.breakLoop()});return q};i.some=function(e,k,r){k=k||i.identity;if(A&&e.some===A)return e.some(k,r);var q=false;J(e,function(G,K,P){if(q=k.call(r,G,K,P))i.breakLoop()});return q};i.include=function(e,k){if(L&&e.indexOf===L)return e.indexOf(k)!=-1;var r=false;J(e,function(q){if(r=q===k)i.breakLoop()});return r};i.invoke=function(e,k){var r=i.rest(arguments,2);return i.map(e,function(q){return(k?
-q[k]:q).apply(q,r)})};i.pluck=function(e,k){return i.map(e,function(r){return r[k]})};i.max=function(e,k,r){if(!k&&i.isArray(e))return Math.max.apply(Math,e);var q={computed:-Infinity};J(e,function(G,K,P){K=k?k.call(r,G,K,P):G;K>=q.computed&&(q={value:G,computed:K})});return q.value};i.min=function(e,k,r){if(!k&&i.isArray(e))return Math.min.apply(Math,e);var q={computed:Infinity};J(e,function(G,K,P){K=k?k.call(r,G,K,P):G;K<q.computed&&(q={value:G,computed:K})});return q.value};i.sortBy=function(e,
-k,r){return i.pluck(i.map(e,function(q,G,K){return{value:q,criteria:k.call(r,q,G,K)}}).sort(function(q,G){q=q.criteria;G=G.criteria;return q<G?-1:q>G?1:0}),"value")};i.sortedIndex=function(e,k,r){r=r||i.identity;for(var q=0,G=e.length;q<G;){var K=q+G>>1;r(e[K])<r(k)?(q=K+1):(G=K)}return q};i.toArray=function(e){if(!e)return[];if(e.toArray)return e.toArray();if(i.isArray(e))return e;if(i.isArguments(e))return s.call(e);return i.values(e)};i.size=function(e){return i.toArray(e).length};i.first=function(e,
-k,r){return k&&!r?s.call(e,0,k):e[0]};i.rest=function(e,k,r){return s.call(e,i.isUndefined(k)||r?1:k)};i.last=function(e){return e[e.length-1]};i.compact=function(e){return i.filter(e,function(k){return!!k})};i.flatten=function(e){return i.reduce(e,[],function(k,r){if(i.isArray(r))return k.concat(i.flatten(r));k.push(r);return k})};i.without=function(e){var k=i.rest(arguments);return i.filter(e,function(r){return!i.include(k,r)})};i.uniq=function(e,k){return i.reduce(e,[],function(r,q,G){if(0==G||
-(k===true?i.last(r)!=q:!i.include(r,q)))r.push(q);return r})};i.intersect=function(e){var k=i.rest(arguments);return i.filter(i.uniq(e),function(r){return i.every(k,function(q){return i.indexOf(q,r)>=0})})};i.zip=function(){for(var e=i.toArray(arguments),k=i.max(i.pluck(e,"length")),r=new Array(k),q=0;q<k;q++)r[q]=i.pluck(e,String(q));return r};i.indexOf=function(e,k){if(L&&e.indexOf===L)return e.indexOf(k);for(var r=0,q=e.length;r<q;r++)if(e[r]===k)return r;return-1};i.lastIndexOf=function(e,k){if(I&&
-e.lastIndexOf===I)return e.lastIndexOf(k);for(var r=e.length;r--;)if(e[r]===k)return r;return-1};i.range=function(e,k,r){var q=i.toArray(arguments),G=q.length<=1;e=G?0:q[0];k=G?q[0]:q[1];r=q[2]||1;q=Math.ceil((k-e)/r);if(q<=0)return[];q=new Array(q);G=e;for(var K=0;;G+=r){if((r>0?G-k:k-G)>=0)return q;q[K++]=G}};i.bind=function(e,k){var r=i.rest(arguments,2);return function(){return e.apply(k||{},r.concat(i.toArray(arguments)))}};i.bindAll=function(e){var k=i.rest(arguments);if(k.length==0)k=i.functions(e);
-J(k,function(r){e[r]=i.bind(e[r],e)});return e};i.delay=function(e,k){var r=i.rest(arguments,2);return setTimeout(function(){return e.apply(e,r)},k)};i.defer=function(e){return i.delay.apply(i,[e,1].concat(i.rest(arguments)))};i.wrap=function(e,k){return function(){var r=[e].concat(i.toArray(arguments));return k.apply(k,r)}};i.compose=function(){var e=i.toArray(arguments);return function(){for(var k=i.toArray(arguments),r=e.length-1;r>=0;r--)k=[e[r].apply(this,k)];return k[0]}};i.keys=N||function(e){if(i.isArray(e))return i.range(0,
-e.length);var k=[];for(var r in e)B.call(e,r)&&k.push(r);return k};i.values=function(e){return i.map(e,i.identity)};i.functions=function(e){return i.filter(i.keys(e),function(k){return i.isFunction(e[k])}).sort()};i.extend=function(e){J(i.rest(arguments),function(k){for(var r in k)e[r]=k[r]});return e};i.clone=function(e){if(i.isArray(e))return e.slice(0);return i.extend({},e)};i.tap=function(e,k){k(e);return e};i.isEqual=function(e,k){if(e===k)return true;var r=typeof e;if(r!=typeof k)return false;
-if(e==k)return true;if(!e&&k||e&&!k)return false;if(e.isEqual)return e.isEqual(k);if(i.isDate(e)&&i.isDate(k))return e.getTime()===k.getTime();if(i.isNaN(e)&&i.isNaN(k))return true;if(i.isRegExp(e)&&i.isRegExp(k))return e.source===k.source&&e.global===k.global&&e.ignoreCase===k.ignoreCase&&e.multiline===k.multiline;if(r!=="object")return false;if(e.length&&e.length!==k.length)return false;r=i.keys(e);var q=i.keys(k);if(r.length!=q.length)return false;for(var G in e)if(!(G in k)||!i.isEqual(e[G],k[G]))return false;
-return true};i.isEmpty=function(e){if(i.isArray(e)||i.isString(e))return e.length===0;for(var k in e)if(B.call(e,k))return false;return true};i.isElement=function(e){return!!(e&&e.nodeType==1)};i.isArray=o||function(e){return!!(e&&e.concat&&e.unshift&&!e.callee)};i.isArguments=function(e){return e&&e.callee};i.isFunction=function(e){return!!(e&&e.constructor&&e.call&&e.apply)};i.isString=function(e){return!!(e===""||e&&e.charCodeAt&&e.substr)};i.isNumber=function(e){return e===+e||v.call(e)==="[object Number]"};
-i.isBoolean=function(e){return e===true||e===false};i.isDate=function(e){return!!(e&&e.getTimezoneOffset&&e.setUTCFullYear)};i.isRegExp=function(e){return!!(e&&e.test&&e.exec&&(e.ignoreCase||e.ignoreCase===false))};i.isNaN=function(e){return i.isNumber(e)&&isNaN(e)};i.isNull=function(e){return e===null};i.isUndefined=function(e){return typeof e=="undefined"};i.noConflict=function(){x._=E;return this};i.identity=function(e){return e};i.times=function(e,k,r){for(var q=0;q<e;q++)k.call(r,q)};i.breakLoop=
-function(){throw w;};i.mixin=function(e){J(i.functions(e),function(k){Q(k,i[k]=e[k])})};var U=0;i.uniqueId=function(e){var k=U++;return e?e+k:k};i.templateSettings={start:"<%",end:"%>",interpolate:/<%=(.+?)%>/g};i.template=function(e,k){var r=i.templateSettings,q=new RegExp("'(?=[^"+r.end.substr(0,1)+"]*"+t(r.end)+")","g");e=new Function("obj","var p=[],print=function(){p.push.apply(p,arguments);};with(obj){p.push('"+e.replace(/[\r\t\n]/g," ").replace(q,"\t").split("'").join("\\'").split("\t").join("'").replace(r.interpolate,
-"',$1,'").split(r.start).join("');").split(r.end).join("p.push('")+"');}return p.join('');");return k?e(k):e};i.each=i.forEach;i.foldl=i.inject=i.reduce;i.foldr=i.reduceRight;i.select=i.filter;i.all=i.every;i.any=i.some;i.head=i.first;i.tail=i.rest;i.methods=i.functions;var R=function(e){this._wrapped=e},S=function(e,k){return k?i(e).chain():e},Q=function(e,k){R.prototype[e]=function(){var r=i.toArray(arguments);C.call(r,this._wrapped);return S(k.apply(i,r),this._chain)}};i.mixin(i);J(["pop","push",
-"reverse","shift","sort","splice","unshift"],function(e){var k=h[e];R.prototype[e]=function(){k.apply(this._wrapped,arguments);return S(this._wrapped,this._chain)}});J(["concat","join","slice"],function(e){var k=h[e];R.prototype[e]=function(){return S(k.apply(this._wrapped,arguments),this._chain)}});R.prototype.chain=function(){this._chain=true;return this};R.prototype.value=function(){return this._wrapped}})();j._.noConflict()});
-bespin.tiki.require("bespin:plugins").catalog.registerMetadata({bespin:{testmodules:[],resourceURL:"resources/bespin/",name:"bespin",environments:{main:true,worker:true},type:"plugins/boot"},syntax_directory:{resourceURL:"resources/syntax_directory/",name:"syntax_directory",environments:{main:true,worker:true},dependencies:{},testmodules:[],provides:[{register:"#discoveredNewSyntax",ep:"extensionhandler",name:"syntax"}],type:"plugins/supported",description:"Catalogs the available syntax engines"},
-underscore:{testmodules:[],type:"plugins/thirdparty",resourceURL:"resources/underscore/",description:"Functional Programming Aid for Javascript. Works well with jQuery.",name:"underscore"}});typeof window==="undefined"?importScripts("BespinWorker.js"):function(){var y=document.createElement("script");y.setAttribute("src",bespin.base+"BespinMain.js");document.getElementsByTagName("head")[0].appendChild(y)}();
deleted file mode 100644
--- a/mail/test/resources/mozmill/mozmill/extension/content/editor/bespin/BespinMain.js
+++ /dev/null
@@ -1,471 +0,0 @@
-bespin.tiki.register("::text_editor",{name:"text_editor",dependencies:{completion:"0.0.0",undomanager:"0.0.0",settings:"0.0.0",canon:"0.0.0",rangeutils:"0.0.0",traits:"0.0.0",theme_manager:"0.0.0",keyboard:"0.0.0",edit_session:"0.0.0",syntax_manager:"0.0.0"}});
-bespin.tiki.module("text_editor:commands/editing",function(y,s){var v=y("settings").settings,r=y("environment").env,l=y("rangeutils:utils/range");s.backspace=function(){r.view.performBackspaceOrDelete(true)};s.deleteCommand=function(){r.view.performBackspaceOrDelete(false)};s.deleteLines=function(){if(!r.model.readOnly)if(r.model.lines.length!=1){var d=r.view;d.groupChanges(function(){var f=d.getSelectedRange(),m=r.model.lines,i=m.length-1,g;g=f.start.row==i?{col:m[i-1].length,row:i-1}:{col:0,row:f.start.row};
-d.replaceCharacters({start:g,end:f.end.row==i?{col:m[i].length,row:i}:{col:0,row:f.end.row+1}},"");d.moveCursorTo(g)})}};var h=function(d,f){var m=f.getSelectedRange().start;d=/^\s*/.exec(d.lines[m.row].substring(0,m.col));f.insertText("\n"+d)};s.insertText=function(d){r.view.insertText(d.text)};s.newline=function(){h(r.model,r.view)};s.joinLines=function(){var d=r.model;if(!d.readOnly){var f=r.view,m=f.getSelectedRange(),i=d.lines,g=m.end.row;i.length!=g&&f.groupChanges(function(){f.replaceCharacters({start:{col:i[g].length,
-row:g},end:{col:/^\s*/.exec(i[g+1])[0].length,row:g+1}},"")})}};s.openLine=function(){if(!r.model.readOnly){var d=r.model,f=r.view,m=f.getSelectedRange().end.row;f.moveCursorTo({row:m,col:d.lines[m].length});h(d,f)}};s.tab=function(){var d=r.view;d.groupChanges(function(){var f=v.get("tabstop"),m=d.getSelectedRange(),i="";if(l.isZeroLength(m)){var g=r.model.lines[m.start.row].substring(m.start.col).match(/^\s*/)[0].length;f=f-(m.start.col+g)%f;for(var j=0;j<f;j++)i+=" ";d.replaceCharacters({start:m.start,
-end:m.start},i);d.moveCursorTo({col:m.start.col+f+g,row:m.end.row})}else{for(j=0;j<f;j++)i+=" ";for(j=m.start.row-1;j++<m.end.row;){g=j==m.start.row?m.start.col:0;d.replaceCharacters({start:{row:j,col:g},end:{row:j,col:g}},i)}d.setSelection({start:m.start,end:{col:m.end.col+f,row:m.end.row}})}}.bind(this))};s.untab=function(){var d=r.view;d.groupChanges(function(){var f=v.get("tabstop"),m=d.getSelectedRange(),i=r.model.lines,g=0;if(l.isZeroLength(m)){g=Math.min(i[m.start.row].substring(0,m.start.col).match(/\s*$/)[0].length,
-(m.start.col-f)%f||f);d.replaceCharacters({start:{col:m.start.col-g,row:m.start.row},end:m.start},"");d.moveCursorTo({row:m.start.row,col:m.end.col-g})}else{for(var j,q=m.start.row-1;q++<m.end.row;){j=q==m.start.row?m.start.col:0;g=Math.min(i[q].substring(j).match(/^\s*/)[0].length,f);d.replaceCharacters({start:{row:q,col:j},end:{row:q,col:j+g}},"")}d.setSelection({start:{row:m.start.row,col:m.start.col},end:{row:m.end.row,col:m.end.col-g}})}}.bind(this))}});
-bespin.tiki.module("text_editor:commands/editor",function(y,s){y("bespin:plugins");var v=y("settings").settings,r=y("environment").env;s.findNextCommand=function(){var h=r.view,d=h.editor.searchController,f=h.getSelectedRange();if(d=d.findNext(f.end,true)){h.setSelection(d,true);h.focus()}};s.findPrevCommand=function(){var h=r.view,d=h.editor.searchController,f=h.getSelectedRange();if(d=d.findPrevious(f.start,true)){h.setSelection(d,true);h.focus()}};var l=function(h){var d=r.view,f=d.getSelectedCharacters();
-h=h(f);d=d.getSelectedRange();r.model.replaceCharacters(d,h)};s.replaceCommand=function(h){l(function(d){return d.replace(h.search+"/g",h.replace)})};s.entabCommand=function(){tabstop=v.get("tabstop");l(function(h){return h.replace(" {"+tabstop+"}","\t")})};s.detabCommand=function(){tabstop=v.get("tabstop");l(function(h){return h.replace("\t",(new Array(tabstop+1)).join(" "))})};s.trimCommand=function(h){l(function(d){d=d.split("\n");d=d.map(function(f){if(h.side==="left"||h.side==="both")f=f.replace(/^\s+/,
-"");if(h.side==="right"||h.side==="both")f=f.replace(/\s+$/,"");return f});return d.join("\n")})};s.ucCommand=function(){l(function(h){return h.toUpperCase()})};s.lcCommand=function(){l(function(h){return h.toLowerCase()})}});
-bespin.tiki.module("text_editor:commands/movement",function(y,s){y("rangeutils:utils/range");var v=y("environment").env;s.moveDown=function(){v.view.moveDown()};s.moveLeft=function(){v.view.moveLeft()};s.moveRight=function(){v.view.moveRight()};s.moveUp=function(){v.view.moveUp()};s.selectDown=function(){v.view.selectDown()};s.selectLeft=function(){v.view.selectLeft()};s.selectRight=function(){v.view.selectRight()};s.selectUp=function(){v.view.selectUp()};var r=function(m,i){var g=v.view,j=v.model.lines,
-q=g.getSelectedRange(true);i=i?q.end.row:j.length-1;g.moveCursorTo({row:i,col:j[i].length},m)};s.moveLineEnd=function(){r(false,true)};s.selectLineEnd=function(){r(true,true)};s.moveDocEnd=function(){r(false,false)};s.selectDocEnd=function(){r(true,false)};var l=function(m,i){var g=v.view,j=g.getSelectedRange(true);g.moveCursorTo({row:i?j.end.row:0,col:0},m)};s.moveLineStart=function(){l(false,true)};s.selectLineStart=function(){l(true,true)};s.moveDocStart=function(){l(false,false)};s.selectDocStart=
-function(){l(true,false)};var h=function(m,i,g,j,q){var t=0,B=false;if(j<0){g--;if(q)t=1}for(;g<i.length&&g>-1;){if(q=m.isDelimiter(i[g]))t++;else B=true;if((q||t>1)&&B)break;g+=j}j<0&&g++;return g},d=function(m){var i=v.view,g=v.model.lines,j=i.getSelectedRange(true).end,q=j.row;j=j.col;var t=g[q],B=false;if(j>=t.length){q++;B=true;if(q<g.length){j=0;t=g[q]}else t=""}j=h(i,t,j,1,B);i.moveCursorTo({row:q,col:j},m)},f=function(m){var i=v.view,g=v.model.lines,j=i.getSelectedRange(true).end,q=j.row;
-j=j.col;var t=g[q],B=false;if(j>t.length)j=t.length;else if(j==0){q--;B=true;if(q>-1){t=g[q];j=t.length}else t=""}j=h(i,t,j,-1,B);i.moveCursorTo({row:q,col:j},m)};s.moveNextWord=function(){d(false)};s.selectNextWord=function(){d(true)};s.movePreviousWord=function(){f(false)};s.selectPreviousWord=function(){f(true)};s.selectAll=function(){v.view.selectAll()}});
-bespin.tiki.module("text_editor:commands/scrolling",function(y,s){var v=y("environment").env;s.scrollDocStart=function(){v.view.scrollToPosition({col:0,row:0})};s.scrollDocEnd=function(){v.view.scrollToPosition(v.model.range.end)};s.scrollPageDown=function(){v.view.scrollPageDown()};s.scrollPageUp=function(){v.view.scrollPageUp()}});
-bespin.tiki.module("text_editor:controllers/layoutmanager",function(y,s){var v=y("bespin:util/util"),r=y("events").Event;y("rangeutils:utils/range");var l=y("syntax_manager").SyntaxManager,h=y("models/textstorage").TextStorage,d=y("bespin:plugins").catalog,f=y("settings").settings,m=y("bespin:util/scratchcanvas"),i={};y=function(){var g=f.get("fontsize"),j=f.get("fontface");j=g+"px "+j;for(var q=m.get(),t="",B=0;B<100;B++)t+="M";j=q.measureStringWidth(j,t)/100;i.characterWidth=j;i.lineHeight=Math.floor(g*
-1.6);i.lineAscent=Math.floor(g*1.3)};y();d.registerExtension("settingChange",{match:"font[size|face]",pointer:y});s.LayoutManager=function(g){this.changedTextAtRow=new r;this.invalidatedRects=new r;this.fontDimension=i;if(g.textStorage){g._textStorage=g.textStorage;delete g.textStorage}else this._textStorage=new h;v.mixin(this,g);this._textStorage.changed.add(this.textStorageChanged.bind(this));this.textLines=[{characters:"",colors:[{start:0,end:0,color:"plain"}]}];this.syntaxManager=g=new l(this);
-g.attrsChanged.add(this._attrsChanged.bind(this));this._size={width:0,height:0};this.sizeChanged=new r;this._height=0;this._recomputeEntireLayout()};s.LayoutManager.prototype={_maximumWidth:0,_textStorage:null,_size:null,sizeChanged:null,_theme:{},margin:{left:5,bottom:6,top:0,right:12},pluginCatalog:d,syntaxManager:null,textLines:null,_attrsChanged:function(g,j){this.updateTextRows(g,j);this.invalidatedRects(this,this.rectsForRange({start:{row:g,col:0},end:{row:j,col:0}}))},_computeInvalidRects:function(g,
-j){var q=this.characterRectForPosition(g.start),t={x:q.x,y:q.y,width:Number.MAX_VALUE,height:q.height};return g.end.row===j.end.row?[t]:[t,{x:0,y:q.y+i.lineHeight,width:Number.MAX_VALUE,height:Number.MAX_VALUE}]},_lastCharacterPosition:function(){return{row:this.textLines.length-1,col:this._maximumWidth}},_recalculateMaximumWidth:function(){var g=0;this.textLines.forEach(function(j){j=j.characters.length;if(g<j)g=j});this._maximumWidth=g;this.size={width:g,height:this.textLines.length}},_recomputeEntireLayout:function(){var g=
-this._textStorage.range;this._recomputeLayoutForRanges(g,g)},_recomputeLayoutForRanges:function(g,j){for(var q=g.start.row,t=g.end.row,B=j.end.row,C=B-q+1,e=this._textStorage.lines,K=this._theme.plain,L=[],n=0;n<C;n++)L[n]={characters:e[q+n],colors:[{start:0,end:null,color:K}]};this.textLines=v.replace(this.textLines,q,t-q+1,L);this._recalculateMaximumWidth();t=this.textLines.length;C=this.syntaxManager;if(this._height!==t)this._height=t;C.invalidateRow(q);this.updateTextRows(q,B+1);this.changedTextAtRow(this,
-q);this.invalidatedRects(this,this._computeInvalidRects(g,j))},boundingRect:function(){return this.rectsForRange({start:{row:0,col:0},end:{row:this.textLines.length-1,col:this._maximumWidth}})[0]},characterAtPoint:function(g){var j=this.margin,q=g.x-j.left,t=i.characterWidth,B=this._textStorage;g=B.clampPosition({row:Math.floor((g.y-j.top)/i.lineHeight),col:Math.floor(q/t)});B=B.lines[g.row].length;g.partialFraction=q<0||g.col===B?0:q%t/t;return g},characterRangeForBoundingRect:function(g){var j=
-i.lineHeight,q=i.characterWidth,t=this.margin,B=g.x-t.left;t=g.y-t.top;return{start:{row:Math.max(Math.floor(t/j),0),col:Math.max(Math.floor(B/q),0)},end:{row:Math.floor((t+g.height-1)/j),col:Math.floor((B+g.width-1)/q)+1}}},characterRectForPosition:function(g){return this.rectsForRange({start:g,end:{row:g.row,col:g.col+1}})[0]},lineRectForRow:function(g){return this.rectsForRange({start:{row:g,col:0},end:{row:g,col:this._maximumWidth}})[0]},rectForPosition:function(g){var j=this.margin,q=i.characterWidth,
-t=i.lineHeight;return{x:j.left+q*g.col,y:j.top+t*g.row,width:q,height:t}},rectsForRange:function(g){var j=i.characterWidth,q=i.lineHeight,t=this._maximumWidth,B=this.margin,C=g.start,e=g.end;g=C.row;var K=C.col;C=e.row;e=e.col;if(g===C)return[{x:B.left+j*K,y:B.top+q*g,width:j*(e-K),height:q}];var L=[],n;if(K===0)n=g;else{n=g+1;L.push({x:B.left+j*K,y:B.top+q*g,width:99999,height:q})}if(e===0)t=C-1;else if(e===t)t=C;else{t=C-1;L.push({x:B.left,y:B.top+q*C,width:j*e,height:q})}L.push({x:B.left,y:B.top+
-q*n,width:99999,height:q*(t-n+1)});return L},textStorageChanged:function(g,j){this._recomputeLayoutForRanges(g,j)},updateTextRows:function(g,j){var q=this.textLines;j=this.syntaxManager.getAttrsForRows(g,j);for(var t=0;t<j.length;t++)q[g+t].colors=j[t]}};Object.defineProperties(s.LayoutManager.prototype,{size:{set:function(g){if(g.width!==this._size.width||g.height!==this._size.height){this.sizeChanged(g);this._size=g}},get:function(){return this._size}},textStorage:{get:function(){return this._textStorage}}})});
-bespin.tiki.module("text_editor:controllers/search",function(y,s){var v=y("bespin:util/util");y("rangeutils:utils/range");y("bespin:console");s.EditorSearchController=function(r){this.editor=r};s.EditorSearchController.prototype={editor:null,_escapeString:/(\/|\.|\*|\+|\?|\||\(|\)|\[|\]|\{|\}|\\)/g,_findMatchesInString:function(r){var l=[],h=this.searchRegExp,d;for(h.lastIndex=0;;){d=h.exec(r);if(d===null)break;l.push(d);h.lastIndex=d.index+d[0].length}return l},_makeRange:function(r,l){return{start:{row:l,
-col:r.index},end:{row:l,col:r.index+r[0].length}}},isRegExp:null,searchRegExp:null,searchText:null,setSearchText:function(r,l){this.searchRegExp=l?new RegExp(r):new RegExp(r.replace(this._escapeString,"\\$1"),"gi");this.isRegExp=l;this.searchText=r},findNext:function(r,l){var h=this.searchRegExp;if(v.none(h))return null;r=r||this.editor.textView.getSelectedRange().end;var d=this.editor.layoutManager.textStorage.lines,f;h.lastIndex=r.col;var m;for(m=r.row;m<d.length;m++){f=h.exec(d[m]);if(!v.none(f))return this._makeRange(f,
-m)}if(!l)return null;for(m=0;m<=r.row;m++){f=h.exec(d[m]);if(!v.none(f))return this._makeRange(f,m)}return null},findPrevious:function(r,l){if(v.none(this.searchRegExp))return null;r=r||this.editor.textView.getSelectedRange().start;var h=this.editor.buffer.layoutManager.textStorage.lines,d;d=this._findMatchesInString(h[r.row].substring(0,r.col));if(d.length!==0)return this._makeRange(d[d.length-1],r.row);var f;for(f=r.row-1;f!==-1;f--){d=this._findMatchesInString(h[f]);if(d.length!==0)return this._makeRange(d[d.length-
-1],f)}if(!l)return null;for(f=h.length-1;f>=r.row;f--){d=this._findMatchesInString(h[f]);if(d.length!==0)return this._makeRange(d[d.length-1],f)}return null}}});
-bespin.tiki.module("text_editor:controllers/undo",function(y,s){var v=y("bespin:console").console,r=y("environment").env;s.EditorUndoController=function(l){this.editor=l;l=this.textView=l.textView;l.beganChangeGroup.add(function(h,d){this._beginTransaction();this._record.selectionBefore=d}.bind(this));l.endedChangeGroup.add(function(h,d){this._record.selectionAfter=d;this._endTransaction()}.bind(this));l.replacedCharacters.add(function(h,d,f){if(!this._inTransaction)throw new Error("UndoController.textViewReplacedCharacters() called outside a transaction");
-this._record.patches.push({oldCharacters:this._deletedCharacters,oldRange:d,newCharacters:f,newRange:this.editor.layoutManager.textStorage.resultingRangeForReplacement(d,f.split("\n"))});this._deletedCharacters=null}.bind(this));l.willReplaceRange.add(function(h,d){if(!this._inTransaction)throw new Error("UndoController.textViewWillReplaceRange() called outside a transaction");this._deletedCharacters=this.editor.layoutManager.textStorage.getCharacters(d)}.bind(this))};s.EditorUndoController.prototype=
-{_inTransaction:false,_record:null,textView:null,_beginTransaction:function(){if(this._inTransaction){v.trace();throw new Error("UndoController._beginTransaction() called with a transaction already in place");}this._inTransaction=true;this._record={patches:[]}},_endTransaction:function(){if(!this._inTransaction)throw new Error("UndoController._endTransaction() called without a transaction in place");this.editor.buffer.undoManager.registerUndo(this,this._record);this._record=null;this._inTransaction=
-false},_tryApplyingPatches:function(l){var h=this.editor.layoutManager.textStorage;l.forEach(function(d){h.replaceCharacters(d.oldRange,d.newCharacters)});return true},_undoOrRedo:function(l,h){if(this._inTransaction)throw new Error("UndoController._undoOrRedo() called while in a transaction");if(!this._tryApplyingPatches(l))return false;this.textView.setSelection(h,true);return true},redo:function(l){var h=l.patches.concat();h.reverse();return this._undoOrRedo(h,l.selectionAfter)},undo:function(l){return this._undoOrRedo(l.patches.map(function(h){return{oldCharacters:h.newCharacters,
-oldRange:h.newRange,newCharacters:h.oldCharacters,newRange:h.oldRange}}),l.selectionBefore)}};s.undoManagerCommand=function(l,h){r.editor.buffer.undoManager[h.commandExt.name]()}});
-bespin.tiki.module("text_editor:models/buffer",function(y,s){var v=y("environment").env,r=y("bespin:util/util"),l=y("bespin:promise").Promise,h=y("models/textstorage").TextStorage,d=y("controllers/layoutmanager").LayoutManager,f=y("undomanager").UndoManager;s.Buffer=function(m,i){this._file=m;this._model=new h(i);this._layoutManager=new d({textStorage:this._model});this.undoManager=new f;if(m)this.reload().then(function(){this._updateSyntaxManagerInitialContext()}.bind(this));else{this.loadPromise=
-new l;this.loadPromise.resolve()}i=v.session?v.session.history:null;var g,j,q;if(i&&m&&(g=i.getHistoryForPath(m.path))){j=g.selection;q=g.scroll}this._selectedRange=j||{start:{row:0,col:0},end:{row:0,col:0}};this._scrollOffset=q||{x:0,y:0}};s.Buffer.prototype={undoManager:null,loadPromise:null,_scrollOffset:null,_selectedRange:null,_selectedRangeEndVirtual:null,_layoutManager:null,_file:null,_model:null,save:function(){return this._file.saveContents(this._model.value)},saveAs:function(m){var i=new l;
-m.saveContents(this._model.value).then(function(){this._file=m;this._updateSyntaxManagerInitialContext();i.resolve()}.bind(this),function(g){i.reject(g)});return i},reload:function(){var m=this,i;return this.loadPromise=i=this._file.loadContents().then(function(g){m._model.value=g})},_updateSyntaxManagerInitialContext:function(){var m=this._file.extension();this._layoutManager.syntaxManager.setSyntaxFromFileExt(m===null?"":m)},untitled:function(){return r.none(this._file)}};Object.defineProperties(s.Buffer.prototype,
-{layoutManager:{get:function(){return this._layoutManager}},syntaxManager:{get:function(){}},file:{get:function(){return this._file}},model:{get:function(){return this._model}}})});
-bespin.tiki.module("text_editor:models/textstorage",function(y,s){var v=y("events").Event,r=y("bespin:util/util");y=function(l){this._lines=l!==null&&l!==undefined?l.split("\n"):[""];this.changed=new v;return this};y.prototype={_lines:null,readOnly:false,clampPosition:function(l){var h=this._lines,d=l.row;if(d<0)return{row:0,col:0};else if(d>=h.length)return this.range.end;l=Math.max(0,Math.min(l.col,h[d].length));return{row:d,col:l}},clampRange:function(l){var h=this.clampPosition(l.start);l=this.clampPosition(l.end);
-return{start:h,end:l}},deleteCharacters:function(l){this.replaceCharacters(l,"")},displacePosition:function(l,h){var d=h>0,f=this._lines,m=f.length;for(h=Math.abs(h);h!==0;h--)if(d){var i=f[l.row].length;if(l.row===m-1&&l.col===i)return l;l=l.col===i?{row:l.row+1,col:0}:{row:l.row,col:l.col+1}}else{if(l.row===0&&l.col==0)return l;if(l.col===0){f=this._lines;l={row:l.row-1,col:f[l.row-1].length}}else l={row:l.row,col:l.col-1}}return l},getCharacters:function(l){var h=this._lines,d=l.start,f=l.end,
-m=d.row;l=f.row;var i=d.col;d=f.col;if(m===l)return h[m].substring(i,d);f=h[m].substring(i);m=h.slice(m+1,l);h=h[l].substring(0,d);return[f].concat(m,h).join("\n")},getLines:function(){return this._lines},getRange:function(){var l=this._lines,h=l.length-1;return{start:{row:0,col:0},end:{row:h,col:l[h].length}}},getValue:function(){return this._lines.join("\n")},insertCharacters:function(l,h){this.replaceCharacters({start:l,end:l},h)},replaceCharacters:function(l,h){if(this.readOnly)throw new Error("Attempt to modify a read-only text storage object");
-var d=h.split("\n"),f=d.length,m=this.resultingRangeForReplacement(l,d),i=l.start,g=l.end,j=i.row,q=g.row,t=this._lines;d[0]=t[j].substring(0,i.col)+d[0];d[f-1]+=t[q].substring(g.col);this._lines=r.replace(t,j,q-j+1,d);this.changed(l,m,h)},resultingRangeForReplacement:function(l,h){var d=h.length;l=l.start;return{start:l,end:{row:l.row+d-1,col:(d===1?l.col:0)+h[d-1].length}}},setLines:function(l){this.setValue(l.join("\n"))},setValue:function(l){this.replaceCharacters(this.range,l)}};s.TextStorage=
-y;Object.defineProperties(s.TextStorage.prototype,{lines:{get:function(){return this.getLines()},set:function(l){return this.setLines(l)}},range:{get:function(){return this.getRange()}},value:{get:function(){return this.getValue()},set:function(l){this.setValue(l)}}})});
-bespin.tiki.module("text_editor:utils/rect",function(y,s){s._distanceFromBounds=function(v,r,l){if(v<r)return v-r;if(v>=l)return v-l;return 0};s.merge=function(v){var r;do{r=false;for(var l=[],h=0;h<v.length;h++){var d=v[h];l.push(d);for(var f=h+1;f<v.length;f++){var m=v[f];if(s.rectsSideBySide(d,m)||s.rectsIntersect(d,m)){v.splice(f,1);l[l.length-1]=s.unionRects(d,m);r=true;break}}}v=l}while(r);return v};s.offsetFromRect=function(v,r){return{x:s._distanceFromBounds(r.x,v.x,s.maxX(v)),y:s._distanceFromBounds(r.y,
-v.y,s.maxY(v))}};s.rectsIntersect=function(v,r){v=s.intersectRects(v,r);return v.width!==0&&v.height!==0};s.rectsSideBySide=function(v,r){if(v.x==r.x&&v.width==r.width)return v.y<r.y?v.y+v.height==r.y:r.y+r.height==v.y;else if(v.y==r.y&&v.height==r.height)return v.x<r.x?v.x+v.width==r.x:r.x+r.width==v.x;return false};s.intersectRects=function(v,r){v={x:Math.max(s.minX(v),s.minX(r)),y:Math.max(s.minY(v),s.minY(r)),width:Math.min(s.maxX(v),s.maxX(r)),height:Math.min(s.maxY(v),s.maxY(r))};v.width=Math.max(0,
-v.width-v.x);v.height=Math.max(0,v.height-v.y);return v};s.minX=function(v){return v.x||0};s.maxX=function(v){return(v.x||0)+(v.width||0)};s.minY=function(v){return v.y||0};s.maxY=function(v){return(v.y||0)+(v.height||0)};s.pointInRect=function(v,r){return v.x>=s.minX(r)&&v.y>=s.minY(r)&&v.x<=s.maxX(r)&&v.y<=s.maxY(r)};s.unionRects=function(v,r){v={x:Math.min(s.minX(v),s.minX(r)),y:Math.min(s.minY(v),s.minY(r)),width:Math.max(s.maxX(v),s.maxX(r)),height:Math.max(s.maxY(v),s.maxY(r))};v.width=Math.max(0,
-v.width-v.x);v.height=Math.max(0,v.height-v.y);return v};s.rectsEqual=function(v,r,l){if(!v||!r)return v==r;if(!l&&l!==0)l=0.1;if(v.y!=r.y&&Math.abs(v.y-r.y)>l)return false;if(v.x!=r.x&&Math.abs(v.x-r.x)>l)return false;if(v.width!=r.width&&Math.abs(v.width-r.width)>l)return false;if(v.height!=r.height&&Math.abs(v.height-r.height)>l)return false;return true}});
-bespin.tiki.module("text_editor:views/canvas",function(y,s){var v=y("bespin:util/util"),r=y("utils/rect"),l=y("events").Event;s.CanvasView=function(h,d,f){if(h){this._preventDownsize=d||false;this._clearOnFullInvalid=f||false;this._clippingFrame=this._frame={x:0,y:0,width:0,height:0};this._invalidRects=[];d=document.createElement("canvas");d.setAttribute("style","position: absolute");d.innerHTML="canvas tag not supported by your browser";h.appendChild(d);this.domNode=d;this.clippingChanged=new l;
-this.clippingChanged.add(this.clippingFrameChanged.bind(this))}};s.CanvasView.prototype={domNode:null,clippingChanged:null,_canvasContext:null,_canvasId:null,_invalidRects:null,_lastRedrawTime:null,_redrawTimer:null,_clippingFrame:null,_preventDownsize:false,_clearOnFullInvalid:false,_frame:null,_getContext:function(){if(this._canvasContext===null)this._canvasContext=this.domNode.getContext("2d");return this._canvasContext},computeWithClippingFrame:function(h,d){var f=this.clippingFrame;return{x:h+
-f.x,y:d+f.y}},minimumRedrawDelay:1E3/30,clippingFrameChanged:function(){this.invalidate()},drawRect:function(){},render:function(){if(!(this._renderTimer||this._redrawTimer))this._renderTimer=setTimeout(this._tryRedraw.bind(this),0)},invalidate:function(){this._invalidRects="all";this.render()},invalidateRect:function(h){var d=this._invalidRects;if(d!=="all"){d.push(h);this.render()}},_tryRedraw:function(){this._renderTimer=null;var h=(new Date).getTime(),d=this._lastRedrawTime,f=this.minimumRedrawDelay;
-if(d===null||h-d>=f)this._redraw();else if(this._redrawTimer===null)this._redrawTimer=window.setTimeout(this._redraw.bind(this),f)},_redraw:function(){var h=this.clippingFrame;h={x:Math.round(h.x),y:Math.round(h.y),width:h.width,height:h.height};var d=this._getContext();d.save();d.translate(-h.x,-h.y);var f=this._invalidRects;if(f==="all"){this._clearOnFullInvalid&&d.clearRect(0,0,this.domNode.width,this.domNode.height);this.drawRect(h,d)}else r.merge(f).forEach(function(m){m=r.intersectRects(m,h);
-if(m.width!==0&&m.height!==0){d.save();var i=m.x,g=m.y,j=m.width,q=m.height;d.beginPath();d.moveTo(i,g);d.lineTo(i+j,g);d.lineTo(i+j,g+q);d.lineTo(i,g+q);d.closePath();d.clip();this.drawRect(m,d);d.restore()}},this);d.restore();this._invalidRects=[];this._redrawTimer=null;this._lastRedrawTime=(new Date).getTime()}};Object.defineProperties(s.CanvasView.prototype,{clippingFrame:{get:function(){return this._clippingFrame},set:function(h){h=v.mixin(v.clone(this._clippingFrame),h);if(this._clippingFrame===
-null||!r.rectsEqual(h,this._clippingFrame)){this._clippingFrame=h;this.clippingChanged()}}},frame:{get:function(){return this._frame},set:function(h){var d=this.domNode,f=d.style,m=this._preventDownsize,i=d.width,g=d.height;f=d.style;f.left=h.x+"px";f.top=h.y+"px";var j,q;if(h.width!==i)if(h.width<i)m||(j=true);else j=true;if(h.height!==g)if(h.height<g)m||(q=true);else q=true;if(j)this.domNode.width=h.width;if(q)this.domNode.height=h.height;this._frame=h;this.clippingFrame={width:h.width,height:h.height}}}})});
-bespin.tiki.module("text_editor:views/editor",function(y,s){function v(n){var w=C.plugins.text_editor.provides,D=w.length,J={};if(n){n=n.themestyles;if(n.currentThemeVariables&&n.currentThemeVariables.text_editor)J=n.currentThemeVariables.text_editor}for(;D--;)if(w[D].ep==="themevariable"){n=h.mixin(h.clone(w[D].defaultValue),J[w[D].name]);switch(w[D].name){case "gutter":case "editor":case "scroller":case "highlighter":L[w[D].name]=n}}}var r=y("rangeutils:utils/range"),l=y("views/scroller"),h=y("bespin:util/util"),
-d=y("models/buffer").Buffer,f=y("completion:controller").CompletionController,m=y("controllers/search").EditorSearchController,i=y("controllers/undo").EditorUndoController,g=y("events").Event,j=y("views/gutter").GutterView;y("controllers/layoutmanager");var q=l.ScrollerCanvasView,t=y("views/text").TextView,B=y("underscore")._,C=y("bespin:plugins").catalog,e=y("keyboard:keyboard").keyboardManager,K=y("settings").settings,L={};v();C.registerExtension("themeChange",{pointer:v});s.EditorView=function(n){this.elementAppended=
-new g;var w=this.element=this.container=document.createElement("div");w.style.overflow="visible";w.style.position="relative";this.scrollOffsetChanged=new g;this.willChangeBuffer=new g;this.selectionChanged=new g;this.textChanged=new g;this.gutterView=new j(w,this);this.textView=new t(w,this);var D=new q(this,l.LAYOUT_VERTICAL),J=new q(this,l.LAYOUT_HORIZONTAL);this.verticalScroller=D;this.horizontalScroller=J;this.completionController=new f(this);this.editorUndoController=new i(this);this.searchController=
-new m(this);this._textViewSize=this._oldSize={width:0,height:0};this._themeData=L;this.buffer=new d(null,n);this.elementAppended.add(function(){var Q=K.get("fontsize"),Z=K.get("fontface");this._font=Q+"px "+Z;C.registerExtension("themeChange",{pointer:this._themeVariableChange.bind(this)});C.registerExtension("settingChange",{match:"font[size|face]",pointer:this._fontSettingChanged.bind(this)});C.registerExtension("dimensionsChanged",{pointer:this.dimensionsChanged.bind(this)});this._dontRecomputeLayout=
-false;this._recomputeLayout();w.addEventListener(h.isMozilla?"DOMMouseScroll":"mousewheel",this._onMouseWheel.bind(this),false);D.valueChanged.add(function(T){this.scrollOffset={y:T}}.bind(this));J.valueChanged.add(function(T){this.scrollOffset={x:T}}.bind(this));this.scrollOffsetChanged.add(function(T){this._updateScrollOffsetChanged(T)}.bind(this))}.bind(this))};s.EditorView.prototype={elementAppended:null,textChanged:null,selectionChanged:null,scrollOffsetChanged:null,willChangeBuffer:null,_textViewSize:null,
-_textLinesCount:0,_gutterViewWidth:0,_oldSize:null,_buffer:null,_dontRecomputeLayout:true,_themeData:null,_layoutManagerSizeChanged:function(n){var w=this.layoutManager.fontDimension;this._textViewSize={width:n.width*w.characterWidth,height:n.height*w.lineHeight};if(this._textLinesCount!==n.height){this.gutterView.computeWidth()!==this._gutterViewWidth?this._recomputeLayout(true):this.gutterView.invalidate();this._textLinesLength=n.height}this._updateScrollers();this.scrollOffset={}},_updateScrollers:function(){if(!this._dontRecomputeLayout){var n=
-this.textViewPaddingFrame,w=this._textViewSize.width,D=this._textViewSize.height,J=this.scrollOffset,Q=this.verticalScroller,Z=this.horizontalScroller;if(D<n.height)Q.isVisible=false;else{Q.isVisible=true;Q.proportion=n.height/D;Q.maximum=D-n.height;Q.value=J.y}if(w<n.width)Z.isVisible=false;else{Z.isVisible=true;Z.proportion=n.width/w;Z.maximum=w-n.width;Z.value=J.x}}},_onMouseWheel:function(n){var w=0;if(n.wheelDelta)w=-n.wheelDelta;else if(n.detail)w=n.detail*40;var D=true;if(n.axis){if(n.axis==
-n.HORIZONTAL_AXIS)D=false}else if(n.wheelDeltaY||n.wheelDeltaX){if(n.wheelDeltaX==n.wheelDelta)D=false}else if(n.shiftKey)D=false;D?this.scrollBy(0,w):this.scrollBy(w*5,0);h.stopEvent(n)},scrollTo:function(n){this.scrollOffset=n},scrollBy:function(n,w){this.scrollOffset={x:this.scrollOffset.x+n,y:this.scrollOffset.y+w}},_recomputeLayout:function(n){if(!this._dontRecomputeLayout){var w=this.container.offsetWidth,D=this.container.offsetHeight;if(!(!n&&w==this._oldSize.width&&D==this._oldSize.height)){this._oldSize=
-{width:w,height:D};this._gutterViewWidth=n=this.gutterView.computeWidth();this.gutterView.frame={x:0,y:0,width:n,height:D};this.textView.frame={x:n,y:0,width:w-n,height:D};var J=this._themeData.scroller.padding,Q=this._themeData.scroller.thickness;this.horizontalScroller.frame={x:n+J,y:D-(Q+J),width:w-(n+2*J+Q),height:Q};this.verticalScroller.frame={x:w-(J+Q),y:J,width:Q,height:D-(2*J+Q)};this.scrollOffset={};this._updateScrollers();this.gutterView.invalidate();this.textView.invalidate();this.verticalScroller.invalidate();
-this.horizontalScroller.invalidate()}}},dimensionsChanged:function(){this._recomputeLayout()},_font:null,_fontSettingChanged:function(){var n=K.get("fontsize"),w=K.get("fontface");this._font=n+"px "+w;this.layoutManager._recalculateMaximumWidth();this._layoutManagerSizeChanged(this.layoutManager.size);this.textView.invalidate()},_themeVariableChange:function(){this._recomputeLayout(true)},_updateScrollOffsetChanged:function(n){this.verticalScroller.value=n.y;this.horizontalScroller.value=n.x;this.textView.clippingFrame=
-{x:n.x,y:n.y};this.gutterView.clippingFrame={y:n.y};this._updateScrollers();this.gutterView.invalidate();this.textView.invalidate()},processKeyEvent:function(n,w,D){D=B(D).clone();D.completing=this.completionController.isCompleting();return e.processKeyEvent(n,w,D)},convertTextViewPoint:function(n){var w=this.scrollOffset;return{x:n.x-w.x+this._gutterViewWidth,y:n.y-w.y}},replace:function(n,w,D){if(!r.isRange(n))throw new Error('replace(): expected range but found "'+n+"'");if(!h.isString(w))throw new Error('replace(): expected text string but found "'+
-text+'"');var J=r.normalizeRange(n),Q=this.textView,Z=Q.getSelectedRange(false);return Q.groupChanges(function(){Q.replaceCharacters(J,w);if(D)Q.setSelection(Z);else{var T=w.split("\n");T=T.length>1?{row:n.start.row+T.length-1,col:T[T.length-1].length}:r.addPositions(n.start,{row:0,col:w.length});Q.moveCursorTo(T)}})},getText:function(n){if(!r.isRange(n))throw new Error('getText(): expected range but found "'+n+'"');return this.layoutManager.textStorage.getCharacters(r.normalizeRange(n))},setLineNumber:function(n){if(!h.isNumber(n))throw new Error("setLineNumber(): lineNumber must be a number");
-this.textView.moveCursorTo({row:n-1,col:0})},setCursor:function(n){if(!r.isPosition(n))throw new Error('setCursor(): expected position but found "'+n+'"');this.textView.moveCursorTo(n)},changeGroup:function(n){return this.textView.groupChanges(function(){n(this)}.bind(this))},addTags:function(n){this.completionController.tags.add(n)}};Object.defineProperties(s.EditorView.prototype,{themeData:{get:function(){return this._themeData},set:function(){throw new Error("themeData can't be changed directly. Use themeManager.");
-}},font:{get:function(){return this._font},set:function(){throw new Error("font can't be changed directly. Use settings fontsize and fontface.");}},buffer:{set:function(n){if(n!==this._buffer){if(!n.loadPromise.isResolved())throw new Error("buffer.set(): the new buffer must first be loaded!");if(this._buffer!==null){this.layoutManager.sizeChanged.remove(this);this.layoutManager.textStorage.changed.remove(this);this.textView.selectionChanged.remove(this)}this.willChangeBuffer(n);C.publish(this,"editorChange",
-"buffer",n);this.layoutManager=n.layoutManager;this._buffer=n;var w=this.layoutManager,D=this.textView;w.sizeChanged.add(this,this._layoutManagerSizeChanged.bind(this));w.textStorage.changed.add(this,this.textChanged.bind(this));D.selectionChanged.add(this,this.selectionChanged.bind(this));this.textView.setSelection(n._selectedRange,false);this.scrollOffsetChanged(n._scrollOffset);this.layoutManager.sizeChanged(this.layoutManager.size);this._recomputeLayout()}},get:function(){return this._buffer}},
-frame:{get:function(){return{width:this.container.offsetWidth,height:this.container.offsetHeight}}},textViewPaddingFrame:{get:function(){var n=h.clone(this.textView.frame),w=this.textView.padding;n.width-=w.left+w.right;n.height-=w.top+w.bottom;return n}},scrollOffset:{set:function(n){if(n.x===undefined)n.x=this.scrollOffset.x;if(n.y===undefined)n.y=this.scrollOffset.y;var w=this.textViewPaddingFrame;if(n.y<0)n.y=0;else if(this._textViewSize.height<w.height)n.y=0;else if(n.y+w.height>this._textViewSize.height)n.y=
-this._textViewSize.height-w.height;if(n.x<0)n.x=0;else if(this._textViewSize.width<w.width)n.x=0;else if(n.x+w.width>this._textViewSize.width)n.x=this._textViewSize.width-w.width;if(!(n.x===this.scrollOffset.x&&n.y===this.scrollOffset.y)){this.buffer._scrollOffset=n;this.scrollOffsetChanged(n);C.publish(this,"editorChange","scrollOffset",n)}},get:function(){return this.buffer._scrollOffset}},readOnly:{get:function(){return this._buffer.model.readOnly},set:function(n){this._buffer.model.readOnly=n}},
-focus:{get:function(){return this.textView.hasFocus},set:function(n){if(!h.isBoolean(n))throw new Error('set focus: expected boolean but found "'+n+'"');this.textView.hasFocus=n}},selection:{get:function(){return h.clone(this.textView.getSelectedRange(false))},set:function(n){if(!r.isRange(n))throw new Error("set selection: position/selection must be supplied");this.textView.setSelection(n)}},selectedText:{get:function(){return this.getText(this.selection)},set:function(n){if(!h.isString(n))throw new Error('set selectedText: expected string but found "'+
-n+'"');return this.replace(this.selection,n)}},value:{get:function(){return this.layoutManager.textStorage.value},set:function(n){if(!h.isString(n))throw new Error('set value: expected string but found "'+n+'"');return this.replace(this.layoutManager.textStorage.range,n,false)}},syntax:{get:function(){return this.layoutManager.syntaxManager.getSyntax()},set:function(n){if(!h.isString(n))throw new Error('set syntax: expected string but found "'+newValue+'"');return this.layoutManager.syntaxManager.setSyntax(n)}}})});
-bespin.tiki.module("text_editor:views/gutter",function(y,s){var v=y("bespin:util/util"),r=y("views/canvas").CanvasView;s.GutterView=function(l,h){r.call(this,l,true);this.editor=h};s.GutterView.prototype=new r;v.mixin(s.GutterView.prototype,{drawRect:function(l,h){var d=this.editor.themeData.gutter;h.fillStyle=d.backgroundColor;h.fillRect(l.x,l.y,l.width,l.height);h.save();h.translate(d.paddingLeft,0);var f=this.editor.layoutManager,m=f.characterRangeForBoundingRect(l);l=Math.min(m.end.row,f.textLines.length-
-1);var i=f.fontDimension.lineAscent;h.fillStyle=d.color;h.font=this.editor.font;for(d=m.start.row;d<=l;d++)h.fillText(""+(d+1),-0.5,f.lineRectForRow(d).y+i-0.5);h.restore()},computeWidth:function(){var l=this.editor.themeData.gutter,h=this.editor.layoutManager;return h.fontDimension.characterWidth*(""+h.textLines.length).length+(l.paddingLeft+l.paddingRight)}})});
-bespin.tiki.module("text_editor:views/scroller",function(y,s){var v=y("bespin:util/util"),r=y("events").Event,l=y("bespin:console").console,h=y("utils/rect"),d=y("views/canvas").CanvasView,f=s.LAYOUT_HORIZONTAL=0,m=s.LAYOUT_VERTICAL=1;s.ScrollerCanvasView=function(i,g){d.call(this,i.container,false,true);this.editor=i;this.layoutDirection=g;i=function(j,q,t){t=t||this.domNode;t.addEventListener(j,function(B){q.call(this,B);v.stopEvent(B)}.bind(this),false)}.bind(this);i("mouseover",this.mouseEntered);
-i("mouseout",this.mouseExited);i("mousedown",this.mouseDown);i("mouseup",this.mouseUp,window);i("mousemove",this.mouseMove,window);this.valueChanged=new r};s.ScrollerCanvasView.prototype=new d;v.mixin(s.ScrollerCanvasView.prototype,{lineHeight:20,proportion:0,layoutDirection:m,_isVisible:false,_maximum:0,_value:0,valueChanged:null,padding:{left:0,bottom:0,top:0,right:0},_mouseDownScreenPoint:null,_mouseDownValue:null,_isMouseOver:false,_scrollTimer:null,_mouseEventPosition:null,_mouseOverHandle:false,
-_drawNib:function(i){var g=this.editor.themeData.scroller,j,q;j=g.nibStyle;q=g.nibArrowStyle;g=g.nibStrokeStyle;var t=Math.floor(7.5);i.fillStyle=j;i.beginPath();i.arc(0,0,Math.floor(7.5),0,Math.PI*2,true);i.closePath();i.fill();i.strokeStyle=g;i.stroke();i.fillStyle=q;i.beginPath();i.moveTo(0,-t+3);i.lineTo(-t+3,t-5);i.lineTo(t-3,t-5);i.closePath();i.fill()},_drawNibs:function(i,g){var j=this._getClientThickness(),q=this._value,t=this._maximum,B=this._isHighlighted();if(B||q!==0){i.save();i.translate(8,
-j/2);i.rotate(Math.PI*1.5);i.moveTo(0,0);this._drawNib(i,g);i.restore()}if(B||q!==t){i.save();i.translate(this._getClientLength()-8,j/2);i.rotate(Math.PI*0.5);i.moveTo(0,0);this._drawNib(i,g);i.restore()}},_getClientFrame:function(){var i=this.frame,g=this.padding;return{x:g.left,y:g.top,width:i.width-(g.left+g.right),height:i.height-(g.top+g.bottom)}},_getClientLength:function(){var i=this._getClientFrame();switch(this.layoutDirection){case f:return i.width;case m:return i.height;default:l.error("unknown layout direction");
-return null}},_getClientThickness:function(){var i=this.padding,g=this.editor.themeData.scroller.thickness;switch(this.layoutDirection){case m:return g-(i.left+i.right);case f:return g-(i.top+i.bottom);default:l.error("unknown layout direction");return null}},_getFrameLength:function(){switch(this.layoutDirection){case f:return this.frame.width;case m:return this.frame.height;default:l.error("unknown layout direction");return null}},_getGutterFrame:function(){var i=this._getClientFrame(),g=this._getClientThickness();
-switch(this.layoutDirection){case m:return{x:i.x,y:i.y+15,width:g,height:Math.max(0,i.height-30)};case f:return{x:i.x+15,y:i.y,width:Math.max(0,i.width-30),height:g};default:l.error("unknown layout direction");return null}},_getGutterLength:function(){var i=this._getGutterFrame(),g;switch(this.layoutDirection){case f:g=i.width;break;case m:g=i.height;break;default:l.error("unknown layout direction");break}return g},_getHandleFrame:function(){var i=this._getGutterFrame(),g=this._getHandleOffset(),
-j=this._getHandleLength();switch(this.layoutDirection){case m:return{x:i.x,y:i.y+g,width:i.width,height:j};case f:return{x:i.x+g,y:i.y,width:j,height:i.height}}},_getHandleLength:function(){var i=this._getGutterLength();return Math.max(i*this.proportion,20)},_getHandleOffset:function(){var i=this._maximum;if(i===0)return 0;var g=this._getGutterLength(),j=this._getHandleLength();return(g-j)*this._value/i},_isHighlighted:function(){return this._isMouseOver===true||this._mouseDownScreenPoint!==null},
-_segmentForMouseEvent:function(i){i={x:i.layerX,y:i.layerY};var g=this._getClientFrame(),j=this.padding;if(!h.pointInRect(i,g))return null;var q=this.layoutDirection;switch(q){case f:if(i.x-j.left<15)return"nib-start";else if(i.x>=g.width-15)return"nib-end";break;case m:if(i.y-j.top<15)return"nib-start";else if(i.y>=g.height-15)return"nib-end";break;default:l.error("unknown layout direction");break}j=this._getHandleFrame();if(h.pointInRect(i,j))return"handle";switch(q){case f:if(i.x<j.x)return"gutter-before";
-else if(i.x>=j.x+j.width)return"gutter-after";break;case m:if(i.y<j.y)return"gutter-before";else if(i.y>=j.y+j.height)return"gutter-after";break;default:l.error("unknown layout direction");break}l.error("_segmentForMouseEvent: point ",i," outside view with handle frame ",j," and client frame ",g);return null},adjustFrame:function(){var i=this.frame;this.set("layout",{left:0,top:0,width:i.width,height:i.height})},drawRect:function(i,g){if(this._isVisible){var j=this._isHighlighted();i=this.editor.themeData.scroller;
-var q=j?i.fullAlpha:i.particalAlpha,t=this.frame;g.clearRect(0,0,t.width,t.height);g.save();t=this.padding;g.translate(t.left,t.top);this._getHandleFrame();t=this._getGutterLength();var B=this._getClientThickness(),C=B/2,e=this.layoutDirection,K=this._getHandleOffset()+15,L=this._getHandleLength();if(e===m){g.translate(B+1,0);g.rotate(Math.PI*0.5)}if(!(t<=L)){g.globalAlpha=q;if(j){j=this._getClientLength();g.fillStyle=i.trackFillStyle;g.fillRect(8.5,0.5,j-16,B-1);g.strokeStyle=i.trackStrokeStyle;
-g.strokeRect(8.5,0.5,j-16,B-1)}j=function(){g.beginPath();g.arc(K+C+0.5,C,C-0.5,Math.PI/2,3*Math.PI/2,false);g.arc(K+L-C-0.5,C,C-0.5,3*Math.PI/2,Math.PI/2,false);g.lineTo(K+C+0.5,B-0.5);g.closePath()};j();t=g.createLinearGradient(K,0,K,B);t.addColorStop(0,i.barFillGradientTopStart);t.addColorStop(0.4,i.barFillGradientTopStop);t.addColorStop(0.41,i.barFillStyle);t.addColorStop(0.8,i.barFillGradientBottomStart);t.addColorStop(1,i.barFillGradientBottomStop);g.fillStyle=t;g.fill();g.save();g.clip();g.fillStyle=
-i.barFillStyle;g.beginPath();g.moveTo(K+C*0.4,C*0.6);g.lineTo(K+C*0.9,B*0.4);g.lineTo(K,B*0.4);g.closePath();g.fill();g.beginPath();g.moveTo(K+L-C*0.4,0+C*0.6);g.lineTo(K+L-C*0.9,0+B*0.4);g.lineTo(K+L,0+B*0.4);g.closePath();g.fill();g.restore();g.save();j();g.strokeStyle=i.trackStrokeStyle;g.stroke();g.restore();this._drawNibs(g,q);g.restore()}}},_repeatAction:function(i,g){if(i()!==false){var j=function(){this._repeatAction(i,100)}.bind(this);this._scrollTimer=setTimeout(j,g)}},_scrollByDelta:function(i){this.value=
-this._value+i},_scrollUpOneLine:function(){this._scrollByDelta(-this.lineHeight);return true},_scrollDownOneLine:function(){this._scrollByDelta(this.lineHeight);return true},_scrollPage:function(){switch(this._segmentForMouseEvent(this._mouseEventPosition)){case "gutter-before":this._scrollByDelta(this._getGutterLength()*-1);break;case "gutter-after":this._scrollByDelta(this._getGutterLength());break;case null:break;default:return false}return true},mouseDown:function(i){this._mouseEventPosition=
-i;this._mouseOverHandle=false;this._getGutterLength();switch(this._segmentForMouseEvent(i)){case "nib-start":this._repeatAction(this._scrollUpOneLine.bind(this),500);break;case "nib-end":this._repeatAction(this._scrollDownOneLine.bind(this),500);break;case "gutter-before":this._repeatAction(this._scrollPage.bind(this),500);break;case "gutter-after":this._repeatAction(this._scrollPage.bind(this),500);break;case "handle":break;default:l.error("_segmentForMouseEvent returned an unknown value");break}switch(this.layoutDirection){case f:this._mouseDownScreenPoint=
-i.pageX;break;case m:this._mouseDownScreenPoint=i.pageY;break;default:l.error("unknown layout direction");break}},mouseMove:function(i){if(this._mouseDownScreenPoint!==null){if(this._segmentForMouseEvent(i)=="handle"||this._mouseOverHandle===true){this._mouseOverHandle=true;if(this._scrollTimer!==null){clearTimeout(this._scrollTimer);this._scrollTimer=null}var g;switch(this.layoutDirection){case f:g=i.pageX;break;case m:g=i.pageY;break;default:l.error("unknown layout direction");break}var j=g-this._mouseDownScreenPoint,
-q=this._maximum,t=this._value,B=this._getGutterLength(),C=this._getHandleLength();this.value=t+q*j/(B-C);this._mouseDownScreenPoint=g}this._mouseEventPosition=i}},mouseEntered:function(){this._isMouseOver=true;this.invalidate()},mouseExited:function(){this._isMouseOver=false;this.invalidate()},mouseUp:function(){this._mouseDownValue=this._mouseDownScreenPoint=null;if(this._scrollTimer){clearTimeout(this._scrollTimer);this._scrollTimer=null}this.invalidate()}});Object.defineProperties(s.ScrollerCanvasView.prototype,
-{isVisible:{set:function(i){if(this._isVisible!==i){this._isVisible=i;this.domNode.style.display=i?"block":"none";i&&this.invalidate()}}},maximum:{set:function(i){if(this._value>this._maximum)this._value=this._maximum;if(i!==this._maximum){this._maximum=i;this.invalidate()}}},value:{set:function(i){if(i<0)i=0;else if(i>this._maximum)i=this._maximum;if(i!==this._value){this._value=i;this.valueChanged(i);this.invalidate()}}}})});
-bespin.tiki.module("text_editor:views/text",function(y,s){var v=y("bespin:plugins").catalog,r=y("bespin:util/util"),l=y("events").Event,h=y("views/canvas").CanvasView;y("controllers/layoutmanager");var d=y("rangeutils:utils/range"),f=y("utils/rect"),m=y("views/textinput").TextInput,i=y("bespin:console").console,g=y("settings").settings;s.TextView=function(j,q){h.call(this,j,true);this.editor=q;this.textInput=new m(j,this);this.padding={top:0,bottom:30,left:0,right:30};this.clippingChanged.add(this.clippingFrameChanged.bind(this));
-j=this.domNode;j.style.cursor="text";j.addEventListener("mousedown",this.mouseDown.bind(this),false);j.addEventListener("mousemove",this.mouseMove.bind(this),false);window.addEventListener("mouseup",this.mouseUp.bind(this),false);q.willChangeBuffer.add(this.editorWillChangeBuffer.bind(this));this.selectionChanged=new l;this.beganChangeGroup=new l;this.endedChangeGroup=new l;this.willReplaceRange=new l;this.replacedCharacters=new l};s.TextView.prototype=new h;r.mixin(s.TextView.prototype,{_dragPoint:null,
-_dragTimer:null,_enclosingScrollView:null,_inChangeGroup:false,_insertionPointBlinkTimer:null,_insertionPointVisible:true,_keyBuffer:"",_keyMetaBuffer:"",_keyState:"start",_hasFocus:false,_mouseIsDown:false,selectionChanged:null,beganChangeGroup:null,endedChangeGroup:null,willReplaceRange:null,replacedCharacters:null,editorWillChangeBuffer:function(j){if(this.editor.layoutManager){var q=this.editor.layoutManager;q.invalidatedRects.remove(this);q.changedTextAtRow.remove(this)}q=j.layoutManager;q.invalidatedRects.add(this,
-this.layoutManagerInvalidatedRects.bind(this));q.changedTextAtRow.add(this,this.layoutManagerChangedTextAtRow.bind(this))},didFocus:function(){this._setFocus(true,true)},didBlur:function(){this._setFocus(false,true)},_drag:function(){var j=this._dragPoint,q=f.offsetFromRect(this.clippingFrame,j);this.moveCursorTo(this._selectionPositionForPoint({x:j.x-q.x,y:j.y-q.y}),true)},_drawInsertionPoint:function(j,q){if(this._insertionPointVisible){var t=this.editor.layoutManager.characterRectForPosition(this.editor.buffer._selectedRange.start);
-j=Math.floor(t.x);var B=t.y,C=Math.ceil(t.width);t=t.height;q.save();var e=this.editor.themeData.editor;if(this._hasFocus){q.strokeStyle=e.cursorColor;q.beginPath();q.moveTo(j+0.5,B);q.lineTo(j+0.5,B+t);q.closePath();q.stroke()}else{q.fillStyle=e.unfocusedCursorBackgroundColor;q.fillRect(j+0.5,B,C-0.5,t);q.strokeStyle=e.unfocusedCursorColor;q.strokeRect(j+0.5,B+0.5,C-1,t-1)}q.restore()}},_drawLines:function(j,q){var t=this.editor.layoutManager,B=t.textLines,C=t.fontDimension.lineAscent,e=this.editor.themeData.highlighter;
-q.save();q.font=this.editor.font;var K=t.characterRangeForBoundingRect(j),L=K.start;K=K.end;for(var n=K.row,w=L.row;w<=n;w++){var D=B[w];if(!r.none(D)){var J=D.characters,Q=J.length,Z=Math.min(K.col,Q),T=L.col;if(!(T>=Q)){D=D.colors;if(D==null)D=[];for(Q=0;Q<D.length&&T<D[Q].start;)Q++;for(var ca=Q<D.length?D[Q].start:T;ca<Z;){j=D[Q];T=j!=null?j.end:Z;j=j!=null?j.tag:"plain";j=e.hasOwnProperty(j)?e[j]:"red";q.fillStyle=j;j=t.characterRectForPosition({row:w,col:ca});ca=J.substring(ca,T);q.fillText(ca,
-j.x,j.y+C);ca=T;Q++}}}}q.restore()},_drawSelectionHighlight:function(j,q){j=this.editor.themeData.editor;j=this._hasFocus?j.selectedTextBackgroundColor:j.unfocusedCursorBackgroundColor;var t=this.editor.layoutManager;q.save();var B=d.normalizeRange(this.editor.buffer._selectedRange);q.fillStyle=j;t.rectsForRange(B).forEach(function(C){q.fillRect(C.x,C.y,C.width,C.height)});q.restore()},_drawSelection:function(j,q){this._rangeIsInsertionPoint(this.editor.buffer._selectedRange)?this._drawInsertionPoint(j,
-q):this._drawSelectionHighlight(j,q)},_getVirtualSelection:function(j){var q=this.editor.buffer._selectedRange,t=this.editor.buffer._selectedRangeEndVirtual;return{start:j&&t?t:q.start,end:t||q.end}},_invalidateSelection:function(){var j=function(B){return{x:B.x-1,y:B.y,width:B.width+2,height:B.height}},q=this.editor.layoutManager,t=d.normalizeRange(this.editor.buffer._selectedRange);if(this._rangeIsInsertionPoint(t)){q=q.characterRectForPosition(t.start);this.invalidateRect(j(q))}else q.rectsForRange(t).forEach(function(B){this.invalidateRect(j(B))},
-this)},_isReadOnly:function(){return this.editor.layoutManager.textStorage.readOnly},_keymappingChanged:function(){this._keyBuffer="";this._keyState="start"},_performVerticalKeyboardSelection:function(j){var q=this.editor.buffer._selectedRangeEndVirtual;this.moveCursorTo(d.addPositions(q!==null?q:this.editor.buffer._selectedRange.end,{row:j,col:0}),true,true)},_rangeIsInsertionPoint:function(j){return d.isZeroLength(j)},_rearmInsertionPointBlinkTimer:function(){this._insertionPointVisible||this.blinkInsertionPoint();
-this._insertionPointBlinkTimer!==null&&clearInterval(this._insertionPointBlinkTimer);this._insertionPointBlinkTimer=setInterval(this.blinkInsertionPoint.bind(this),750)},_repositionSelection:function(){var j=this.editor.layoutManager.textLines,q=j.length,t=this.editor.buffer._selectedRange,B=Math.min(t.start.row,q-1);q=Math.min(t.end.row,q-1);var C=j[q];this.setSelection({start:{row:B,col:Math.min(t.start.col,j[B].characters.length)},end:{row:q,col:Math.min(t.end.col,C.characters.length)}})},_scrollPage:function(j){this.editor.scrollBy(0,
-(this.clippingFrame.height+this.editor.layoutManager.fontDimension.lineAscent)*(j?-1:1))},_scrollWhileDragging:function(){var j=this._dragPoint;j=this.computeWithClippingFrame(j.layerX,j.layerY);r.mixin(this._dragPoint,j);this._drag()},_selectionPositionForPoint:function(j){j=this.editor.layoutManager.characterAtPoint(j);return j.partialFraction<0.5?j:d.addPositions(j,{row:0,col:1})},_syntaxManagerUpdatedSyntaxForRows:function(j,q){if(j!==q){var t=this.editor.layoutManager;t.updateTextRows(j,q);t.rectsForRange({start:{row:j,
-col:0},end:{row:q,col:0}}).forEach(this.invalidateRect,this)}},blinkInsertionPoint:function(){this._insertionPointVisible=!this._insertionPointVisible;this._invalidateSelection()},copy:function(){return this.getSelectedCharacters()},cut:function(){var j=this.getSelectedCharacters();j!=""&&this.performBackspaceOrDelete(false);return j},drawRect:function(j,q){q.fillStyle=this.editor.themeData.editor.backgroundColor;q.fillRect(j.x,j.y,j.width,j.height);this._drawSelection(j,q);this._drawLines(j,q)},
-focus:function(){this.textInput.focus()},getInsertionPointPosition:function(){var j=this.editor;j=j.layoutManager.characterRectForPosition(j.buffer._selectedRange.start);return{x:j.x,y:j.y}},getSelectedCharacters:function(){return this._rangeIsInsertionPoint(this.editor.buffer._selectedRange)?"":this.editor.layoutManager.textStorage.getCharacters(d.normalizeRange(this.editor.buffer._selectedRange))},getSelectedRange:function(j){return j?this.editor.buffer._selectedRange:d.normalizeRange(this.editor.buffer._selectedRange)},
-groupChanges:function(j){if(this._isReadOnly())return false;if(this._inChangeGroup){j();return true}this._inChangeGroup=true;this.beganChangeGroup(this,this.editor.buffer._selectedRange);try{j()}catch(q){i.error("Error in groupChanges(): "+q);this._inChangeGroup=false;this.endedChangeGroup(this,this.editor.buffer._selectedRange);return false}finally{this._inChangeGroup=false;this.endedChangeGroup(this,this.editor.buffer._selectedRange);return true}},insertText:function(j){if(this._isReadOnly())return false;
-this.groupChanges(function(){var q=d.normalizeRange(this.editor.buffer._selectedRange);this.replaceCharacters(q,j);var t=j.split("\n");this.moveCursorTo(t.length>1?{row:q.start.row+t.length-1,col:t[t.length-1].length}:d.addPositions(q.start,{row:0,col:j.length}))}.bind(this));return true},isDelimiter:function(j){return"\"',;.!~@#$%^&*?[]<>():/\\-+ \t".indexOf(j)!==-1},keyDown:function(j){if(j.charCode===0||j._charCode===0)return this.editor.processKeyEvent(j,this,{isTextView:true});else if(j.keyCode===
-9)j.preventDefault();else return false},layoutManagerChangedTextAtRow:function(){this._repositionSelection()},layoutManagerInvalidatedRects:function(j,q){q.forEach(this.invalidateRect,this)},mouseDown:function(j){r.stopEvent(j);this._mouseIsDown=this.hasFocus=true;var q=this.computeWithClippingFrame(j.layerX,j.layerY);r.mixin(q,{layerX:j.layerX,layerY:j.layerY});switch(j.detail){case 1:var t=this._selectionPositionForPoint(q);this.moveCursorTo(t,j.shiftKey);break;case 2:t=this._selectionPositionForPoint(q);
-var B=this.editor.layoutManager.textStorage.lines[t.row];if(B.length===0)return true;t.col-=t.col==B.length?1:0;var C=!this.isDelimiter(B[t.col]),e=this,K=function(L,n){for(;L>-1&&L<B.length;L+=n)if(e.isDelimiter(B[L])===C)break;return L+(n==1?0:1)};j=K(t.col,-1);K=K(t.col,1);this.moveCursorTo({row:t.row,col:j});this.moveCursorTo({row:t.row,col:K},true);break;case 3:j=this.editor.layoutManager.textStorage.lines;t=this._selectionPositionForPoint(q);this.setSelection({start:{row:t.row,col:0},end:{row:t.row,
-col:j[t.row].length}});break}this._dragPoint=q;this._dragTimer=setInterval(this._scrollWhileDragging.bind(this),100)},mouseMove:function(j){if(this._mouseIsDown){this._dragPoint=this.computeWithClippingFrame(j.layerX,j.layerY);r.mixin(this._dragPoint,{layerX:j.layerX,layerY:j.layerY});this._drag()}},mouseUp:function(){this._mouseIsDown=false;if(this._dragTimer!==null){clearInterval(this._dragTimer);this._dragTimer=null}},moveCursorTo:function(j,q,t){var B=this.editor.layoutManager.textStorage,C=B.clampPosition(j);
-this.setSelection({start:q?this.editor.buffer._selectedRange.start:C,end:C});if(t){q=B.lines.length;t=j.row;B=j.col;this.editor.buffer._selectedRangeEndVirtual=t>0&&t<q?j:{row:t<1?0:q-1,col:B}}else this.editor.buffer._selectedRangeEndVirtual=null;this.scrollToPosition(this.editor.buffer._selectedRange.end)},moveDown:function(){var j=this._getVirtualSelection();j=d.normalizeRange(j);j=this._rangeIsInsertionPoint(this.editor.buffer._selectedRange)?j.end:{row:j.end.row,col:j.start.col};j=d.addPositions(j,
-{row:1,col:0});this.moveCursorTo(j,false,true)},moveLeft:function(){var j=d.normalizeRange(this.editor.buffer._selectedRange);this._rangeIsInsertionPoint(j)?this.moveCursorTo(this.editor.layoutManager.textStorage.displacePosition(j.start,-1)):this.moveCursorTo(j.start)},moveRight:function(){var j=d.normalizeRange(this.editor.buffer._selectedRange);this._rangeIsInsertionPoint(j)?this.moveCursorTo(this.editor.layoutManager.textStorage.displacePosition(j.end,1)):this.moveCursorTo(j.end)},moveUp:function(){var j=
-d.normalizeRange(this._getVirtualSelection(true));position=d.addPositions({row:j.start.row,col:this._getVirtualSelection().end.col},{row:-1,col:0});this.moveCursorTo(position,false,true)},parentViewFrameChanged:function(){arguments.callee.base.apply(this,arguments);this._resize()},replaceCharacters:function(j,q){if(this._isReadOnly())return false;this.groupChanges(function(){j=d.normalizeRange(j);this.willReplaceRange(this,j);this.editor.layoutManager.textStorage.replaceCharacters(j,q);this.replacedCharacters(this,
-j,q)}.bind(this));return true},performBackspaceOrDelete:function(j){if(this._isReadOnly())return false;var q=this.editor.layoutManager.textStorage,t=q.lines,B="";B=0;var C=g.get("tabstop"),e=this.getSelectedRange();if(d.isZeroLength(e))if(j){j=e.start;B=t[j.row];B=B.substring(0,j.col).match(/\s*$/)[0].length<C||(j.col-C)%C!=0?1:C;e={start:q.displacePosition(j,B*-1),end:e.end}}else{j=e.end;B=t[j.row];B=B.substring(j.col).match(/^\s*/)[0].length<C?1:C;e={start:e.start,end:q.displacePosition(e.end,B)}}this.groupChanges(function(){this.replaceCharacters(e,
-"");this.moveCursorTo(e.start)}.bind(this));return true},resetKeyBuffers:function(){this._keyMetaBuffer=this._keyBuffer=""},scrollPageDown:function(){this._scrollPage(false)},scrollPageUp:function(){this._scrollPage(true)},scrollToPosition:function(j){var q=this.editor.layoutManager.characterRectForPosition(j);j=q.x;var t=q.y,B=q.width;q=q.height;var C=this.clippingFrame,e=C.x,K=C.y,L=this.padding,n=C.width-L.right;C=C.height-L.bottom;this.editor.scrollTo({x:j>=e+30&&j+B<e+n?e:j-n/2+B/2,y:t>=K&&t+
-q<K+C?K:t-C/2+q/2})},selectAll:function(){var j=this.editor.layoutManager.textStorage.lines,q=j.length-1;this.setSelection({start:{row:0,col:0},end:{row:q,col:j[q].length}})},selectDown:function(){this._performVerticalKeyboardSelection(1)},selectLeft:function(){this.moveCursorTo(this.editor.layoutManager.textStorage.displacePosition(this.editor.buffer._selectedRange.end,-1),true)},selectRight:function(){this.moveCursorTo(this.editor.layoutManager.textStorage.displacePosition(this.editor.buffer._selectedRange.end,
-1),true)},selectUp:function(){this._performVerticalKeyboardSelection(-1)},setSelection:function(j,q){var t=this.editor.layoutManager.textStorage;j=t.clampRange(j);if(!d.equal(j,this.editor.buffer._selectedRange)){this._invalidateSelection();this.editor.buffer._selectedRange=j=t.clampRange(j);this._invalidateSelection();this._hasFocus&&this._rearmInsertionPointBlinkTimer();q&&this.scrollToPosition(j.end);this.selectionChanged(j);v.publish(this.editor,"editorChange","selection",j)}},textInserted:function(j){if(j!==
-"\n")if(!this.editor.processKeyEvent(j,this,{isTextView:true,isCommandKey:false})){this.insertText(j);this.resetKeyBuffers()}},_setFocus:function(j,q){if(j!=this._hasFocus)if(this._hasFocus=j){this._rearmInsertionPointBlinkTimer();this._invalidateSelection();q||this.textInput.focus()}else{if(this._insertionPointBlinkTimer){clearInterval(this._insertionPointBlinkTimer);this._insertionPointBlinkTimer=null}this._insertionPointVisible=true;this._invalidateSelection();q||this.textInput.blur()}}});Object.defineProperties(s.TextView.prototype,
-{hasFocus:{get:function(){return this._hasFocus},set:function(j){this._setFocus(j,false)}}})});
-bespin.tiki.module("text_editor:views/textinput",function(y,s){var v=y("bespin:util/util");y("events");var r=y("keyboard:keyutil");s.TextInput=function(l,h){var d=this.domNode=document.createElement("textarea");d.setAttribute("style","position: absolute; z-index: -99999; width: 0px; height: 0px; margin: 0px; outline: none; border: 0;");l.appendChild(d);this.delegate=h;this._attachEvents()};s.TextInput.prototype={_composing:false,domNode:null,delegate:null,_textFieldChanged:function(){if(!(this._composing||
-this._ignore)){var l=this.domNode,h=l.value;if(h!=""){l.value="";this._textInserted(h)}}},_copy:function(){var l=false,h=this.delegate;if(h&&h.copy)l=h.copy();return l},_cut:function(){var l=false,h=this.delegate;if(h&&h.cut)l=h.cut();return l},_textInserted:function(l){var h=this.delegate;h&&h.textInserted&&h.textInserted(l)},_setValueAndSelect:function(l){var h=this.domNode;h.value=l;h.select()},focus:function(){this.domNode.focus()},blur:function(){this.domNode.blur()},_attachEvents:function(){var l=
-this.domNode,h=this;l.addEventListener("focus",function(){h.delegate&&h.delegate.didFocus&&h.delegate.didFocus()},false);l.addEventListener("blur",function(){h.delegate&&h.delegate.didBlur&&h.delegate.didBlur()},false);r.addKeyDownListener(l,function(g){return h.delegate&&h.delegate.keyDown?h.delegate.keyDown(g):false});if(v.isWebKit){v.isChrome||l.addEventListener("compositionend",function(g){h._textInserted(g.data)},false);l.addEventListener("textInput",function(g){h._textInserted(g.data)},false);
-l.addEventListener("paste",function(g){h._textInserted(g.clipboardData.getData("text/plain"));g.preventDefault()},false)}else{var d=h._textFieldChanged.bind(h);l.addEventListener("keydown",function(){window.setTimeout(d,0)},false);l.addEventListener("keypress",d,false);l.addEventListener("keyup",d,false);l.addEventListener("compositionstart",function(){h._composing=true},false);l.addEventListener("compositionend",function(){h._composing=false;h._textFieldChanged()},false);l.addEventListener("paste",
-function(){h._setValueAndSelect("");window.setTimeout(function(){h._textFieldChanged()},0)},false)}var f=function(g){g=g.type.indexOf("copy")!=-1?h._copy():h._cut();h._setValueAndSelect(g)};if(v.isWebKit&&!v.isChrome&&v.isMac){var m=(new Date).getTime(),i=function(g){var j=g.type.indexOf("cut")!=-1;if(!(j&&(new Date).getTime()-m<10)){f(g);if(j)m=(new Date).getTime()}};l.addEventListener("beforecopy",i,false);l.addEventListener("beforecut",i,false)}else{i=false;if(v.isMozilla)i=function(g){f(g);h._ignore=
-true;window.setTimeout(function(){h._setValueAndSelect("");h._ignore=false},0)};l.addEventListener("copy",i||f,false);l.addEventListener("cut",i||f,false)}}}});bespin.tiki.module("text_editor:index",function(){});bespin.tiki.register("::less",{name:"less",dependencies:{}});
-bespin.tiki.module("less:index",function(y,s){function v(d){if(d instanceof h.Dimension)return parseFloat(d.unit=="%"?d.value/100:d.value);else if(typeof d==="number")return d;else throw{error:"RuntimeError",message:"color functions take numbers as parameters"};}function r(d){return Math.min(1,Math.max(0,d))}if(!Array.isArray)Array.isArray=function(d){return Object.prototype.toString.call(d)==="[object Array]"||d instanceof Array};if(!Array.prototype.forEach)Array.prototype.forEach=function(d,f){for(var m=
-this.length>>>0,i=0;i<m;i++)i in this&&d.call(f,this[i],i,this)};if(!Array.prototype.map)Array.prototype.map=function(d,f){for(var m=this.length>>>0,i=new Array(m),g=0;g<m;g++)if(g in this)i[g]=d.call(f,this[g],g,this);return i};if(!Array.prototype.filter)Array.prototype.filter=function(d,f){for(var m=[],i=0;i<this.length;i++)d.call(f,this[i])&&m.push(this[i]);return m};if(!Array.prototype.reduce)Array.prototype.reduce=function(d){var f=this.length>>>0,m=0;if(f===0&&arguments.length===1)throw new TypeError;
-if(arguments.length>=2)var i=arguments[1];else{do{if(m in this){i=this[m++];break}if(++m>=f)throw new TypeError;}while(1)}for(;m<f;m++)if(m in this)i=d.call(null,i,this[m],m,this);return i};if(!Array.prototype.indexOf)Array.prototype.indexOf=function(d,f){var m=this.length;f=f||0;if(!m)return-1;if(f>=m)return-1;if(f<0)f+=m;for(;f<m;f++)if(Object.prototype.hasOwnProperty.call(this,f))if(d===this[f])return f;return-1};if(!Object.keys)Object.keys=function(d){var f=[];for(var m in d)Object.prototype.hasOwnProperty.call(d,
-m)&&f.push(m);return f};if(!String.prototype.trim)String.prototype.trim=function(){return String(this).replace(/^\s\s*/,"").replace(/\s\s*$/,"")};if(typeof y!=="undefined")var l=s,h={};else l=h={};l.Parser=function(d){function f(n){var w,D,J;if(n instanceof Function)return n.call(C.parsers);else if(typeof n==="string"){w=i.charAt(g)===n?n:null;D=1}else{if(g>=B+t[j].length&&j<t.length-1)B+=t[j++].length;n.lastIndex=J=g-B;if(w=n.exec(t[j])){D=w[0].length;if(n.lastIndex-D!==J)return}}if(w){g+=D;for(D=
-B+t[j].length;g<=D;){n=i.charCodeAt(g);if(!(n===32||n===10||n===9))break;g++}return typeof w==="string"?w:w.length===1?w[0]:w}}function m(n){var w;if(typeof n==="string")return i.charAt(g)===n;else{n.lastIndex=g;if((w=n.exec(i))&&n.lastIndex-w[0].length===g)return w}}var i,g,j,q,t,B,C,e=this,K=function(){},L=this.imports={paths:d&&d.paths||[],queue:[],files:{},push:function(n,w){var D=this;this.queue.push(n);l.Parser.importer(n,this.paths,function(J){D.queue.splice(D.queue.indexOf(n),1);D.files[n]=
-J;w(J);D.queue.length===0&&K()})}};this.env=d||{};this.optimization="optimization"in this.env?this.env.optimization:1;return C={imports:L,parse:function(n,w){var D,J,Q=null;g=j=B=q=0;t=[];i=n.replace(/\r\n/g,"\n");if(e.optimization>0){i=i.replace(/\/\*(?:[^*]|\*+[^\/*])*\*+\//g,function(ca){return e.optimization>1?"":ca.replace(/\n(\s*\n)+/g,"\n")});t=i.split(/^(?=\n)/mg)}else t=[i];D=new h.Ruleset([],f(this.parsers.primary));D.root=true;D.toCSS=function(ca){var ha,ga;return function(){try{return ca.call(this)}catch(la){ga=
-i.split("\n");ha=(i.slice(0,la.index).match(/\n/g)||"").length+1;for(var ma=la.index,na=-1;ma>=0&&i.charAt(ma)!=="\n";ma--)na++;throw{name:"NameError",message:la.message,line:ha,column:na,extract:[ga[ha-2],ga[ha-1],ga[ha]]};}}}(D.toCSS);if(g<i.length-1){g=q;J=i.split("\n");n=(i.slice(0,g).match(/\n/g)||"").length+1;for(var Z=g,T=-1;Z>=0&&i.charAt(Z)!=="\n";Z--)T++;Q={name:"ParseError",message:"Syntax Error on line "+n,filename:d.filename,line:n,column:T,extract:[J[n-2],J[n-1],J[n]]}}if(this.imports.queue.length>
-0)K=function(){w(Q,D)};else w(Q,D)},parsers:{primary:function(){for(var n,w=[];n=f(this.mixin.definition)||f(this.rule)||f(this.ruleset)||f(this.mixin.call)||f(this.comment)||f(/[\n\s]+/g)||f(this.directive);)w.push(n);return w},comment:function(){var n;if(i.charAt(g)==="/")return(n=f(/\/\*(?:[^*]|\*+[^\/*])*\*+\/\n?/g))?new h.Comment(n):f(/\/\/.*/g)},entities:{quoted:function(){var n;if(!(i.charAt(g)!=='"'&&i.charAt(g)!=="'"))if(n=f(/"((?:[^"\\\r\n]|\\.)*)"|'((?:[^'\\\r\n]|\\.)*)'/g))return new h.Quoted(n[0],
-n[1]||n[2])},keyword:function(){var n;if(n=f(/[A-Za-z-]+/g))return new h.Keyword(n)},call:function(){var n,w;if(n=f(/([a-zA-Z0-9_-]+|%)\(/g)){if(n[1].toLowerCase()==="alpha")return f(this.alpha);w=f(this.entities.arguments);if(f(")"))if(n)return new h.Call(n[1],w)}},arguments:function(){for(var n=[],w;w=f(this.expression);){n.push(w);if(!f(","))break}return n},literal:function(){return f(this.entities.dimension)||f(this.entities.color)||f(this.entities.quoted)},url:function(){var n;if(!(i.charAt(g)!==
-"u"||!f(/url\(/g))){n=f(this.entities.quoted)||f(/[-a-zA-Z0-9_%@$\/.&=:;#+?]+/g);if(!f(")"))throw new Error("missing closing ) for url()");return new h.URL(n.value?n:new h.Anonymous(n))}},variable:function(){var n,w=g;if(i.charAt(g)==="@"&&(n=f(/@[a-zA-Z0-9_-]+/g)))return new h.Variable(n,w)},color:function(){var n;if(i.charAt(g)==="#"&&(n=f(/#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})/g)))return new h.Color(n[1])},dimension:function(){var n;n=i.charCodeAt(g);if(!(n>57||n<45||n===47))if(n=f(/(-?[0-9]*\.?[0-9]+)(px|%|em|pc|ex|in|deg|s|ms|pt|cm|mm)?/g))return new h.Dimension(n[1],
-n[2])}},variable:function(){var n;if(i.charAt(g)==="@"&&(n=f(/(@[a-zA-Z0-9_-]+)\s*:/g)))return n[1]},shorthand:function(){var n,w;if(m(/[@\w.-]+\/[@\w.-]+/g))if((n=f(this.entity))&&f("/")&&(w=f(this.entity)))return new h.Shorthand(n,w)},mixin:{call:function(){for(var n=[],w,D,J,Q=g;w=f(/[#.][a-zA-Z0-9_-]+/g);){n.push(new h.Element(D,w));D=f(">")}f("(")&&(J=f(this.entities.arguments))&&f(")");if(n.length>0&&(f(";")||m("}")))return new h.mixin.Call(n,J,Q)},definition:function(){var n,w=[],D,J;if(!(i.charAt(g)!==
-"."||m(/[^{]*(;|})/g)))if(n=f(/([#.][a-zA-Z0-9_-]+)\s*\(/g)){for(n=n[1];D=f(/@[\w-]+/g)||f(this.entities.literal)||f(this.entities.keyword);){if(D[0]==="@")if(f(":"))if(J=f(this.expression))w.push({name:D,value:J});else throw new Error("Expected value");else w.push({name:D});else w.push({value:D});if(!f(","))break}if(!f(")"))throw new Error("Expected )");if(D=f(this.block))return new h.mixin.Definition(n,w,D)}}},entity:function(){return f(this.entities.literal)||f(this.entities.variable)||f(this.entities.url)||
-f(this.entities.call)||f(this.entities.keyword)},end:function(){return f(";")||m("}")},alpha:function(){var n;if(f(/opacity=/gi))if(n=f(/[0-9]+/g)||f(this.entities.variable)){if(!f(")"))throw new Error("missing closing ) for alpha()");return new h.Alpha(n)}},element:function(){var n;c=f(this.combinator);if(n=f(/[.#:]?[a-zA-Z0-9_-]+/g)||f("*")||f(this.attribute)||f(/\([^)@]+\)/g))return new h.Element(c,n)},combinator:function(){var n;return(n=f(/[+>~]/g)||f("&")||f(/::/g))?new h.Combinator(n):new h.Combinator(i.charAt(g-
-1)===" "?" ":null)},selector:function(){for(var n,w=[];n=f(this.element);)w.push(n);if(w.length>0)return new h.Selector(w)},tag:function(){return f(/[a-zA-Z][a-zA-Z-]*[0-9]?/g)||f("*")},attribute:function(){var n="",w,D,J;if(f("[")){if(w=f(/[a-z-]+/g)||f(this.entities.quoted))n=(J=f(/[|~*$^]?=/g))&&(D=f(this.entities.quoted)||f(/[\w-]+/g))?[w,J,D.toCSS?D.toCSS():D].join(""):w;if(f("]"))if(n)return"["+n+"]"}},block:function(){var n;if(f("{")&&(n=f(this.primary))&&f("}"))return n},ruleset:function(){var n=
-[],w,D,J=g;if(w=m(/([a-z.#: _-]+)[\s\n]*\{/g)){g+=w[0].length-1;n=[new h.Selector([new h.Element(null,w[1])])]}else{for(;w=f(this.selector);){n.push(w);if(!f(","))break}w&&f(this.comment)}if(n.length>0&&(D=f(this.block)))return new h.Ruleset(n,D);else{q=g;g=J}},rule:function(){var n,w=g;if(name=f(this.property)||f(this.variable)){if(name.charAt(0)!="@"&&(match=m(/([^@+\/*(;{}-]*);/g))){g+=match[0].length-1;n=new h.Anonymous(match[1])}else n=name==="font"?f(this.font):f(this.value);if(f(this.end))return new h.Rule(name,
-n,w);else{q=g;g=w}}},"import":function(){var n;if(f(/@import\s+/g)&&(n=f(this.entities.quoted)||f(this.entities.url))&&f(";"))return new h.Import(n,L)},directive:function(){var n,w,D;if(i.charAt(g)==="@")if(w=f(this["import"]))return w;else if(n=f(/@media|@page/g)){D=f(/[^{]+/g).trim();if(w=f(this.block))return new h.Directive(n+" "+D,w)}else if(n=f(/@[-a-z]+/g))if(n==="@font-face"){if(w=f(this.block))return new h.Directive(n,w)}else if((w=f(this.entity))&&f(";"))return new h.Directive(n,w)},font:function(){for(var n=
-[],w=[],D;D=f(this.shorthand)||f(this.entity);)w.push(D);n.push(new h.Expression(w));if(f(","))for(;D=f(this.expression);){n.push(D);if(!f(","))break}return new h.Value(n,f(this.important))},value:function(){for(var n,w=[];n=f(this.expression);){w.push(n);if(!f(","))break}n=f(this.important);if(w.length>0)return new h.Value(w,n)},important:function(){return f(/!\s*important/g)},sub:function(){var n;if(f("(")&&(n=f(this.expression))&&f(")"))return n},multiplication:function(){var n,w,D,J;if(n=f(this.operand)){for(;(D=
-f(/[\/*]/g))&&(w=f(this.operand));)J=new h.Operation(D,[J||n,w]);return J||n}},addition:function(){var n,w,D,J;if(n=f(this.multiplication)){for(;(D=f(/[-+]\s+/g)||i.charAt(g-1)!=" "&&f(/[-+]/g))&&(w=f(this.multiplication));)J=new h.Operation(D,[J||n,w]);return J||n}},operand:function(){return f(this.sub)||f(this.entities.dimension)||f(this.entities.color)||f(this.entities.variable)},expression:function(){for(var n,w=[];n=f(this.addition)||f(this.entity);)w.push(n);if(w.length>0)return new h.Expression(w)},
-property:function(){var n;if(n=f(/(\*?-?[-a-z_0-9]+)\s*:/g))return n[1]}}}};l.Parser.importer=null;h.functions={rgb:function(d,f,m){return this.rgba(d,f,m,1)},rgba:function(d,f,m,i){d=[d,f,m].map(function(g){return v(g)});i=v(i);return new h.Color(d,i)},hsl:function(d,f,m){return this.hsla(d,f,m,1)},hsla:function(d,f,m,i){function g(t){t=t<0?t+1:t>1?t-1:t;return t*6<1?q+(j-q)*t*6:t*2<1?j:t*3<2?q+(j-q)*(2/3-t)*6:q}d=(v(d)%360+360)%360/360;f=v(f);m=v(m);i=v(i);var j=m<=0.5?m*(f+1):m+f-m*f,q=m*2-j;return this.rgba(g(d+
-1/3)*255,g(d)*255,g(d-1/3)*255,i)},opacity:function(d,f){v(f);return new h.Color(d.rgb,v(f))},saturate:function(d,f){d=d.toHSL();d.s+=f.value/100;d.s=r(d.s);return this.hsl(d.h,d.s,d.l)},desaturate:function(d,f){d=d.toHSL();d.s-=f.value/100;d.s=r(d.s);return this.hsl(d.h,d.s,d.l)},lighten:function(d,f){d=d.toHSL();d.l*=1+f.value/100;d.l=r(d.l);return this.hsl(d.h,d.s,d.l)},darken:function(d,f){d=d.toHSL();d.l*=1-f.value/100;d.l=r(d.l);return this.hsl(d.h,d.s,d.l)},greyscale:function(d){return this.desaturate(d,
-new h.Dimension(100))},e:function(d){return new h.Anonymous(d)},"%":function(d){for(var f=Array.prototype.slice.call(arguments,1),m=d.content,i=0;i<f.length;i++)m=m.replace(/%s/,f[i].content).replace(/%[da]/,f[i].toCSS());m=m.replace(/%%/g,"%");return new h.Quoted('"'+m+'"',m)}};h.Alpha=function(d){this.value=d};h.Alpha.prototype={toCSS:function(){return"alpha(opacity="+this.value.toCSS()+")"},eval:function(){return this}};h.Anonymous=function(d){this.value=d.content||d};h.Anonymous.prototype={toCSS:function(){return this.value},
-eval:function(){return this}};h.Call=function(d,f){this.name=d;this.args=f};h.Call.prototype={eval:function(d){var f=this.args.map(function(m){return m.eval(d)});return this.name in h.functions?h.functions[this.name].apply(h.functions,f):new h.Anonymous(this.name+"("+f.map(function(m){return m.toCSS()}).join(", ")+")")},toCSS:function(d){return this.eval(d).toCSS()}};h.Color=function(d,f){if(Array.isArray(d)){this.rgb=d;this.alpha=f}else this.rgb=d.length==6?d.match(/.{2}/g).map(function(m){return parseInt(m,
-16)}):d.split("").map(function(m){return parseInt(m+m,16)})};h.Color.prototype={eval:function(){return this},toCSS:function(){return this.alpha&&this.alpha<1?"rgba("+this.rgb.concat(this.alpha).join(", ")+")":"#"+this.rgb.map(function(d){d=Math.round(d);d=(d>255?255:d<0?0:d).toString(16);return d.length===1?"0"+d:d}).join("")},operate:function(d,f){var m=[];f instanceof h.Color||(f=f.toColor());for(var i=0;i<3;i++)m[i]=h.operate(d,this.rgb[i],f.rgb[i]);return new h.Color(m)},toHSL:function(){var d=
-this.rgb[0]/255,f=this.rgb[1]/255,m=this.rgb[2]/255,i=Math.max(d,f,m),g=Math.min(d,f,m),j,q=(i+g)/2,t=i-g;if(i===g)j=g=0;else{g=q>0.5?t/(2-i-g):t/(i+g);switch(i){case d:j=(f-m)/t+(f<m?6:0);break;case f:j=(m-d)/t+2;break;case m:j=(d-f)/t+4;break}j/=6}return{h:j*360,s:g,l:q}}};h.Comment=function(d){this.value=d};h.Comment.prototype={toCSS:function(){return this.value}};h.Dimension=function(d,f){this.value=parseFloat(d);this.unit=f||null};h.Dimension.prototype={eval:function(){return this},toColor:function(){return new h.Color([this.value,
-this.value,this.value])},toCSS:function(){return this.value+this.unit},operate:function(d,f){return new h.Dimension(h.operate(d,this.value,f.value),this.unit||f.unit)}};h.Directive=function(d,f){this.name=d;if(Array.isArray(f))this.ruleset=new h.Ruleset([],f);else this.value=f};h.Directive.prototype={toCSS:function(d,f){if(this.ruleset){this.ruleset.root=true;return this.name+" {\n "+this.ruleset.toCSS(d,f).trim().replace(/\n/g,"\n ")+"\n}\n"}else return this.name+" "+this.value.toCSS()+";\n"},
-eval:function(d){d.frames.unshift(this);this.ruleset&&this.ruleset.evalRules(d);d.frames.shift();return this},variable:function(d){return h.Ruleset.prototype.variable.call(this.ruleset,d)},find:function(){return h.Ruleset.prototype.find.apply(this.ruleset,arguments)},rulesets:function(){return h.Ruleset.prototype.rulesets.apply(this.ruleset)}};h.Element=function(d,f){this.combinator=d instanceof h.Combinator?d:new h.Combinator(d);this.value=f.trim()};h.Element.prototype.toCSS=function(){return this.combinator.toCSS()+
-this.value};h.Combinator=function(d){this.value=d===" "?" ":d?d.trim():""};h.Combinator.prototype.toCSS=function(){switch(this.value){case "":return"";case " ":return" ";case "&":return"";case ":":return" :";case "::":return"::";case "+":return" + ";case "~":return" ~ ";case ">":return" > "}};h.Expression=function(d){this.value=d};h.Expression.prototype={eval:function(d){return this.value.length>1?new h.Expression(this.value.map(function(f){return f.eval(d)})):this.value[0].eval(d)},toCSS:function(){return this.value.map(function(d){return d.toCSS()}).join(" ")}};
-h.Import=function(d,f){var m=this;this._path=d;this.path=d instanceof h.Quoted?/\.(le?|c)ss$/.test(d.content)?d.content:d.content+".less":d.value.content||d.value;(this.css=/css$/.test(this.path))||f.push(this.path,function(i){m.root=i})};h.Import.prototype={toCSS:function(){return this.css?"@import "+this._path.toCSS()+";\n":""},eval:function(){if(this.css)return this;else{for(var d=0;d<this.root.rules.length;d++)this.root.rules[d]instanceof h.Import&&Array.prototype.splice.apply(this.root.rules,
-[d,1].concat(this.root.rules[d].eval()));return this.root.rules}}};h.Keyword=function(d){this.value=d};h.Keyword.prototype={eval:function(){return this},toCSS:function(){return this.value}};h.mixin={};h.mixin.Call=function(d,f,m){this.selector=new h.Selector(d);this.arguments=f;this.index=m};h.mixin.Call.prototype={eval:function(d){for(var f,m=[],i=false,g=0;g<d.frames.length;g++)if((f=d.frames[g].find(this.selector)).length>0){for(g=0;g<f.length;g++)if(f[g].match(this.arguments,d))try{Array.prototype.push.apply(m,
-f[g].eval(this.arguments,d).rules);i=true}catch(j){throw{message:j.message,index:this.index};}if(i)return m;else throw{message:"No matching definition was found for `"+this.selector.toCSS().trim()+"("+this.arguments.map(function(q){return q.toCSS()}).join(", ")+")`",index:this.index};}throw{message:this.selector.toCSS().trim()+" is undefined",index:this.index};}};h.mixin.Definition=function(d,f,m){this.name=d;this.selectors=[new h.Selector([new h.Element(null,d)])];this.params=f;this.arity=f.length;
-this.rules=m;this._lookups={};this.required=f.reduce(function(i,g){return g.name&&!g.value?i+1:i},0)};h.mixin.Definition.prototype={toCSS:function(){return""},variable:function(d){return h.Ruleset.prototype.variable.call(this,d)},find:function(){return h.Ruleset.prototype.find.apply(this,arguments)},rulesets:function(){return h.Ruleset.prototype.rulesets.apply(this)},eval:function(d,f){for(var m=new h.Ruleset(null,[]),i=0,g;i<this.params.length;i++)if(this.params[i].name)if(g=d&&d[i]||this.params[i].value)m.rules.unshift(new h.Rule(this.params[i].name,
-g.eval(f)));else throw{message:"wrong number of arguments for "+this.name+" ("+d.length+" for "+this.arity+")"};return(new h.Ruleset(null,this.rules)).evalRules({frames:[this,m].concat(f.frames)})},match:function(d,f){var m=d&&d.length||0;if(m<this.required)return false;for(var i=0;i<Math.min(m,this.arity);i++)if(!this.params[i].name)if(!d[i].wildcard)if(d[i].eval(f).toCSS()!=this.params[i].value.eval(f).toCSS())return false;return true}};h.Operation=function(d,f){this.op=d.trim();this.operands=f};
-h.Operation.prototype.eval=function(d){var f=this.operands[0].eval(d);d=this.operands[1].eval(d);var m;if(f instanceof h.Dimension&&d instanceof h.Color)if(this.op==="*"||this.op==="+"){m=d;d=f;f=m}else throw{name:"OperationError",message:"Can't substract or divide a color from a number"};return f.operate(this.op,d)};h.operate=function(d,f,m){switch(d){case "+":return f+m;case "-":return f-m;case "*":return f*m;case "/":return f/m}};h.Quoted=function(d,f){this.value=d;this.content=f};h.Quoted.prototype=
-{toCSS:function(){return this.value},eval:function(){return this}};h.Rule=function(d,f,m){this.name=d;this.value=f instanceof h.Value?f:new h.Value([f]);this.index=m;this.variable=d.charAt(0)==="@"?true:false};h.Rule.prototype.toCSS=function(){return this.variable?"":this.name+": "+this.value.toCSS()+";"};h.Rule.prototype.eval=function(d){return new h.Rule(this.name,this.value.eval(d))};h.Value=function(d){this.value=d;this.is="value"};h.Value.prototype={eval:function(d){return this.value.length===
-1?this.value[0].eval(d):new h.Value(this.value.map(function(f){return f.eval(d)}))},toCSS:function(){return this.value.map(function(d){return d.toCSS()}).join(", ")}};h.Shorthand=function(d,f){this.a=d;this.b=f};h.Shorthand.prototype={toCSS:function(d){return this.a.toCSS(d)+"/"+this.b.toCSS(d)},eval:function(){return this}};h.Ruleset=function(d,f){this.selectors=d;this.rules=f;this._lookups={}};h.Ruleset.prototype={eval:function(){return this},evalRules:function(d){var f=[];this.rules.forEach(function(m){if(m.evalRules)f.push(m.evalRules(d));
-else m instanceof h.mixin.Call?Array.prototype.push.apply(f,m.eval(d)):f.push(m.eval(d))});this.rules=f;return this},match:function(d){return!d||d.length===0},variable:function(d){return this._variables?this._variables[d]:(this._variables=this.rules.reduce(function(f,m){if(m instanceof h.Rule&&m.variable===true)f[m.name]=m;return f},{}))[d]},rulesets:function(){return this._rulesets?this._rulesets:(this._rulesets=this.rules.filter(function(d){if(d instanceof h.Ruleset||d instanceof h.mixin.Definition)return d}))},
-find:function(d,f){f=f||this;var m=[],i=d.toCSS();if(i in this._lookups)return this._lookups[i];this.rulesets().forEach(function(g){if(g!==f)for(var j=0;j<g.selectors.length;j++)if(d.match(g.selectors[j])){d.elements.length>1?Array.prototype.push.apply(m,g.find(new h.Selector(d.elements.slice(1)),f)):m.push(g);break}});return this._lookups[i]=m},toCSS:function(d,f){var m=[],i=[],g=[],j=[];if(this.root){d=[];f={frames:[]};for(var q=0;q<this.rules.length;q++)this.rules[q]instanceof h.Import&&Array.prototype.splice.apply(this.rules,
-[q,1].concat(this.rules[q].eval(f)))}else if(d.length===0)j=this.selectors.map(function(B){return[B]});else for(q=0;q<this.selectors.length;q++)for(var t=0;t<d.length;t++)j.push(d[t].concat([this.selectors[q]]));f.frames.unshift(this);for(q=0;q<this.rules.length;q++)this.rules[q]instanceof h.mixin.Call&&Array.prototype.splice.apply(this.rules,[q,1].concat(this.rules[q].eval(f)));for(q=0;q<this.rules.length;q++){d=this.rules[q];if(d instanceof h.Directive)g.push(d.eval(f).toCSS(j,f));else if(d.rules)g.push(d.toCSS(j,
-f));else if(d instanceof h.Comment)this.root?g.push(d.toCSS()):i.push(d.toCSS());else if(d.toCSS&&!d.variable)i.push(d.eval(f).toCSS());else d.value&&!d.variable&&i.push(d.value.toString())}g=g.join("");if(this.root)m.push(i.join("\n"));else if(i.length>0){j=j.map(function(B){return B.map(function(C){return C.toCSS()}).join("").trim()}).join(j.length>3?",\n":", ");m.push(j," {\n "+i.join("\n ")+"\n}\n")}m.push(g);f.frames.shift();return m.join("")}};h.Selector=function(d){this.elements=d;if(this.elements[0].combinator.value===
-"")this.elements[0].combinator.value=" "};h.Selector.prototype.match=function(d){return this.elements[0].value===d.elements[0].value?true:false};h.Selector.prototype.toCSS=function(){if(this._css)return this._css;return this._css=this.elements.map(function(d){return typeof d==="string"?" "+d.trim():d.toCSS()}).join("")};h.URL=function(d){this.value=d};h.URL.prototype={toCSS:function(){return"url("+this.value.toCSS()+")"},eval:function(){return this}};h.Variable=function(d,f){this.name=d;this.index=
-f};h.Variable.prototype={eval:function(d){var f,m,i=this.name;if(f=h.find(d.frames,function(g){if(m=g.variable(i))return m.value.eval(d)}))return f;else throw{message:"variable "+this.name+" is undefined",index:this.index};}};h.find=function(d,f){for(var m=0,i;m<d.length;m++)if(i=f.call(d,d[m]))return i;return null};(function(){function d(C){for(var e=0;e<t.length;e++)f(t[e],C)}function f(C,e){var K=typeof localStorage!=="undefined"&&localStorage.getItem(C.href),L=K&&JSON.parse(K);i(C.href,function(n,
-w){if(L&&(new Date(w)).valueOf()===(new Date(L.timestamp)).valueOf()){m(L.css,C);e(null,C,{local:true})}else(new l.Parser({optimization:3})).parse(n,function(D,J){if(D)return q(D,C.href);try{e(J,C,{local:false,lastModified:w})}catch(Q){q(Q,C.href)}})},function(n){throw new Error("Couldn't load "+C.href+" ("+n+")");})}function m(C,e,K){var L=document.createElement("style");L.type="text/css";L.media="screen";L.title="less-sheet";if(e){L.title=e.title||e.href.match(/(?:^|\/)([-\w]+)\.[a-z]+$/i)[1];K&&
-typeof localStorage!=="undefined"&&localStorage.setItem(e.href,JSON.stringify({timestamp:K,css:C}))}if(L.styleSheet)L.styleSheet.cssText=C;else L.appendChild(document.createTextNode(C));document.getElementsByTagName("head")[0].appendChild(L)}function i(C,e,K){var L=g();if(window.location.protocol==="file:"){L.open("GET",C,false);L.send(null);L.status===0?e(L.responseText):K(L.status)}else{L.open("GET",C,true);L.onreadystatechange=function(){if(L.readyState==4)if(L.status>=200&&L.status<300)e(L.responseText,
-L.getResponseHeader("Last-Modified"));else typeof K==="function"&&K(L.status)};L.send(null)}}function g(){if(window.XMLHttpRequest)return new XMLHttpRequest;else try{return new ActiveXObject("MSXML2.XMLHTTP.3.0")}catch(C){j("less: browser doesn't support AJAX.");return null}}function j(C){l.env=="development"&&typeof console!=="undefined"&&console.log(C)}function q(C,e){var K=document.createElement("div"),L;K.id="less-error-message";K.innerHTML="<h3>"+(C.message||"There is an error in your .less file")+
-'</h3><p><a href="'+e+'">'+e+"</a> on line "+C.line+", column "+(C.column+1)+":</p>"+'<div>\n<pre class="ctx"><span>[-1]</span>{0}</pre>\n<pre><span>[0]</span>{current}</pre>\n<pre class="ctx"><span>[1]</span>{2}</pre>\n</div>'.replace(/\[(-?\d)\]/g,function(n,w){return C.line+parseInt(w)}).replace(/\{(\d)\}/g,function(n,w){return C.extract[parseInt(w)]}).replace(/\{current\}/,C.extract[1].slice(0,C.column)+'<span class="error">'+C.extract[1].slice(C.column)+"</span>");m("#less-error-message span {margin-right: 15px;}#less-error-message pre {color: #ee4444;padding: 4px 0;margin: 0;}#less-error-message pre.ctx {color: #dd7777;}#less-error-message h3 {padding: 15px 0 5px 0;margin: 0;}#less-error-message a {color: #10a}#less-error-message .error {color: red;font-weight: bold;padding-bottom: 2px;border-bottom: 1px dashed red;}");
-K.style.cssText="font-family: Arial, sans-serif;border: 1px solid #e00;background-color: #eee;border-radius: 5px;color: #e00;padding: 15px;margin-bottom: 15px";if(l.env=="development")L=setInterval(function(){if(document.body){document.body.insertBefore(K,document.body.childNodes[0]);clearInterval(L)}},10)}var t=[];l.env=location.hostname=="127.0.0.1"||location.hostname=="0.0.0.0"||location.hostname=="localhost"||location.protocol=="file:"?"development":"production";var B=setInterval(function(){if(document.body){if(!document.querySelectorAll&&
-typeof jQuery==="undefined")j("No selector method found");else t=(document.querySelectorAll||jQuery).call(document,'link[rel="stylesheet/less"]');clearInterval(B);d(function(C,e,K){m(C.toCSS(),e,K.lastModified);K.local?j("less: loading "+e.href+" from local storage."):j("less: parsed "+e.href+" successfully.")})}},10);if(l.env==="development")refreshTimer=setInterval(function(){/!refresh/.test(location.hash)&&d(function(C,e,K){m(C.toCSS(),e,K)})},1E3);l.Parser.importer=function(C,e,K){f({href:C,title:C},
-function(L){K(L)})}})()});bespin.tiki.register("::theme_manager_base",{name:"theme_manager_base",dependencies:{}});bespin.tiki.module("theme_manager_base:index",function(){});bespin.tiki.register("::canon",{name:"canon",dependencies:{environment:"0.0.0",events:"0.0.0",settings:"0.0.0"}});
-bespin.tiki.module("canon:history",function(y,s){var v=y("bespin:util/stacktrace").Trace,r=y("bespin:plugins").catalog;s.requests=[];s.addRequestOutput=function(l){for(s.requests.push(l);s.requests.length>100;)s.requests.shiftObject();r.publish(this,"addedRequestOutput",null,l)};s.execute=function(l,h){if(h.command)try{h.command(l,h)}catch(d){var f=new v(d,true);console.group("Error executing command '"+h.typed+"'");console.log("command=",h.commandExt);console.log("args=",l);console.error(d);f.log(3);
-console.groupEnd();h.doneWithError(d)}else h.doneWithError("Command not found.")}});
-bespin.tiki.module("canon:request",function(y,s){var v=y("events").Event,r=y("canon:history");s.Request=function(l){l=l||{};this.command=l.command;this.commandExt=l.commandExt;this.args=l.args;this.typed=l.typed;this._begunOutput=false;this.start=new Date;this.end=null;this.error=this.completed=false;this.changed=new v};s.Request.prototype._beginOutput=function(){this._begunOutput=true;this.outputs=[];r.addRequestOutput(this)};s.Request.prototype.doneWithError=function(l){this.error=true;this.done(l)};
-s.Request.prototype.async=function(){this._begunOutput||this._beginOutput()};s.Request.prototype.output=function(l){this._begunOutput||this._beginOutput();if(typeof l!=="string"&&!(l instanceof Node))l=l.toString();this.outputs.push(l);this.changed();return this};s.Request.prototype.done=function(l){this.completed=true;this.end=new Date;this.duration=this.end.getTime()-this.start.getTime();l?this.output(l):this.changed()}});bespin.tiki.module("canon:index",function(){});
-bespin.tiki.register("::traits",{name:"traits",dependencies:{}});
-bespin.tiki.module("traits:index",function(y,s){s.Trait=function(){function v(O){var P=function(){throw new Error("Conflicting property: "+O);};T(P.prototype);return T(P)}function r(){return T({value:undefined,enumerable:false,required:true})}function l(O){O=v(O);return n?T({get:O,set:O,enumerable:false,conflict:true}):T({value:O,enumerable:false,conflict:true})}function h(O,P){return O===P?O!==0||1/O===1/P:O!==O&&P!==P}function d(O,P){return O.conflict&&P.conflict?true:O.get===P.get&&O.set===P.set&&
-h(O.value,P.value)&&O.enumerable===P.enumerable&&O.required===P.required&&O.conflict===P.conflict}function f(O,P){return T(D(O,P))}function m(O){var P={};Z(O,function(S){P[S]=true});return T(P)}function i(O){var P={};Z(ca(O),function(S){var U=ha(O,S);if(U.value===na)U=r(S);else if(typeof U.value==="function"){U.method=true;"prototype"in U.value&&T(U.value.prototype)}else{U.get&&U.get.prototype&&T(U.get.prototype);U.set&&U.set.prototype&&T(U.set.prototype)}P[S]=U});return P}function g(){var O=Q(arguments,
-0),P={};Z(O,function(S){Z(ca(S),function(U){var aa=S[U];if(J(P,U)&&!P[U].required)aa.required||d(P[U],aa)||(P[U]=l(U));else P[U]=aa})});return T(P)}function j(O,P){var S=m(O),U={};Z(ca(P),function(aa){U[aa]=!J(S,aa)||P[aa].required?P[aa]:r(aa)});return T(U)}function q(){var O=Q(arguments,0),P={};Z(O,function(S){Z(ca(S),function(U){var aa=S[U];if(!J(P,U)||P[U].required)P[U]=aa})});return T(P)}function t(O,P){var S={};Z(ca(P),function(U){if(J(O,U)&&!P[U].required){var aa=O[U];S[aa]=J(S,aa)&&!S[aa].required?
-l(aa):P[U];J(S,U)||(S[U]=r(U))}else if(J(S,U))P[U].required||(S[U]=l(U));else S[U]=P[U]});return T(S)}function B(O,P){var S={},U=[];for(var aa in O)if(J(O,aa))if(O[aa])S[aa]=O[aa];else U.push(aa);return t(S,j(U,P))}function C(O,P){var S=ma(O),U={};Z(ca(P),function(aa){var fa=P[aa];if(fa.required&&!(aa in O))throw new Error("Missing required property: "+aa);else if(fa.conflict)throw new Error("Remaining conflicting property: "+aa);else U[aa]="value"in fa?fa.method?{value:f(fa.value,S),enumerable:fa.enumerable,
-configurable:fa.configurable,writable:fa.writable}:fa:{get:fa.get?f(fa.get,S):undefined,set:fa.set?f(fa.set,S):undefined,enumerable:fa.enumerable,configurable:fa.configurable,writable:fa.writable}});la(S,U);return T(S)}function e(O,P){return C(Object.prototype,i(O),P)}function K(O,P){var S=ca(O),U=ca(P);if(S.length!==U.length)return false;for(var aa=0;aa<S.length;aa++){U=S[aa];if(!P[U]||!d(O[U],P[U]))return false}return true}function L(O){return i(O)}var n=!!Object.defineProperty,w=Function.prototype.call,
-D=Function.prototype.bind?function(O,P){return Function.prototype.bind.call(O,P)}:function(O,P){function S(){return O.apply(P,arguments)}return S},J=D(w,Object.prototype.hasOwnProperty),Q=D(w,Array.prototype.slice),Z=Array.prototype.forEach?D(w,Array.prototype.forEach):function(O,P){for(var S=0,U=O.length;S<U;S++)P(O[S])},T=Object.freeze||function(O){return O},ca=Object.getOwnPropertyNames||function(O){var P=[];for(var S in O)J(O,S)&&P.push(S);return P},ha=Object.getOwnPropertyDescriptor||function(O,
-P){return{value:O[P],enumerable:true,writable:true,configurable:true}},ga=Object.defineProperty||function(O,P,S){O[P]=S.value},la=Object.defineProperties||function(O,P){for(var S in P)J(P,S)&&ga(O,S,P[S])},ma=Object.create||function(O,P){function S(){}S.prototype=O||Object.prototype;O=new S;P&&la(O,P);return O};w=Object.getOwnProperties||function(O){var P={};Z(ca(O),function(S){P[S]=ha(O,S)});return P};var na=T({toString:function(){return"<Trait.required>"}});if(!Object.create)Object.create=ma;if(!Object.getOwnProperties)Object.getOwnProperties=
-w;L.required=T(na);L.compose=T(g);L.resolve=T(B);L.override=T(q);L.create=T(C);L.eqv=T(K);L.object=T(e);return T(L)}()});bespin.tiki.register("::keyboard",{name:"keyboard",dependencies:{canon:"0.0.0",settings:"0.0.0"}});
-bespin.tiki.module("keyboard:keyboard",function(y,s){var v=y("bespin:plugins").catalog;y("bespin:console");y("bespin:util/stacktrace");var r=y("bespin:util/util"),l=y("settings").settings,h=y("keyboard:keyutil"),d=y("canon:history"),f=y("canon:request").Request,m=y("environment").env;s.buildFlags=function(i){i.context=m.contexts[0];return i};y=function(){};r.mixin(y.prototype,{_customKeymappingCache:{states:{}},processKeyEvent:function(i,g,j){i=h.commandCodes(i,true)[0];if(r.none(i))return false;
-s.buildFlags(j);j.isCommandKey=true;return this._matchCommand(i,g,j)},_matchCommand:function(i,g,j){var q=this._findCommandExtension(i,g,j);if(q&&q.commandExt!=="no command"){j.isTextView&&g.resetKeyBuffers();var t=q.commandExt;t.load(function(B){B=new f({command:B,commandExt:t});d.execute(q.args,B)});return true}return q&&q.commandExt==="no command"?true:false},_buildBindingsRegex:function(i){i.forEach(function(g){if(r.none(g.key))if(Array.isArray(g.regex)){g.key=new RegExp("^"+g.regex[1]+"$");g.regex=
-new RegExp(g.regex.join("")+"$")}else g.regex=new RegExp(g.regex+"$");else g.key=new RegExp("^"+g.key+"$")})},_buildKeymappingRegex:function(i){for(state in i.states)this._buildBindingsRegex(i.states[state]);i._convertedRegExp=true},_findCommandExtension:function(i,g,j){if(j.isTextView){var q=g._keyState;if(!j.isCommandKey||i.indexOf("alt_")===-1){g._keyBuffer+=i.replace(/ctrl_meta|meta/,"ctrl");g._keyMetaBuffer+=i}var t=[this._customKeymappingCache];t=t.concat(v.getExtensions("keymapping"));for(var B=
-0;B<t.length;B++)if(!r.none(t[B].states[q])){r.none(t[B]._convertedRegExp)&&this._buildKeymappingRegex(t[B]);var C=this._bindingsMatch(i,j,g,t[B]);if(!r.none(C))return C}}g=v.getExtensions("command");var e=null;q={};i=i.replace(/ctrl_meta|meta/,"ctrl");g.some(function(K){if(this._commandMatches(K,i,j)){e=K;return true}return false}.bind(this));return r.none(e)?null:{commandExt:e,args:q}},_bindingsMatch:function(i,g,j,q){var t,B=null,C={},e;e=r.none(q.hasMetaKey)?j._keyMetaBuffer:j._keyBuffer;if(i.indexOf("alt_")===
-0&&g.isCommandKey)e+=i;q.states[j._keyState].some(function(K){if(K.key&&!K.key.test(i))return false;if(K.regex&&!(t=K.regex.exec(e)))return false;if(K.disallowMatches)for(var L=0;L<K.disallowMatches.length;L++)if(t[K.disallowMatches[L]])return true;if(!s.flagsMatch(K.predicates,g))return false;if(K.exec){B=v.getExtensionByKey("command",K.exec);if(r.none(B))throw new Error("Can't find command "+K.exec+" in state="+j._keyState+", symbolicName="+i);if(K.params){var n;K.params.forEach(function(w){n=!r.none(w.match)&&
-!r.none(t)?t[w.match]||w.defaultValue:w.defaultValue;if(w.type==="number")n=parseInt(n);C[w.name]=n})}j.resetKeyBuffers()}if(K.then){j._keyState=K.then;j.resetKeyBuffers()}if(r.none(B))B="no command";return true});if(r.none(B))return null;return{commandExt:B,args:C}},_commandMatches:function(i,g,j){var q=i.key;if(!q)return false;if(!s.flagsMatch(i.predicates,j))return false;if(typeof q==="string"){if(q!=g)return false;return true}if(!Array.isArray(q)){q=[q];i.key=q}for(i=0;i<q.length;i++){var t=q[i];
-if(typeof t==="string"){if(t==g)return true}else if(t.key==g)return s.flagsMatch(t.predicates,j)}return false},_customKeymappingChanged:function(){var i=this._customKeymappingCache=JSON.parse(l.get("customKeymapping"));i.states=i.states||{};for(state in i.states)this._buildBindingsRegex(i.states[state]);i._convertedRegExp=true}});s.flagsMatch=function(i,g){if(r.none(i))return true;if(!g)return false;for(var j in i)if(g[j]!==i[j])return false;return true};s.keyboardManager=new y;v.registerExtension("settingChange",
-{match:"customKeymapping",pointer:s.keyboardManager._customKeymappingChanged.bind(s.keyboardManager)})});
-bespin.tiki.module("keyboard:keyutil",function(y,s){var v=y("bespin:util/util");s.KeyHelper=function(){var l={MODIFIER_KEYS:{16:"shift",17:"ctrl",18:"alt",224:"meta"},FUNCTION_KEYS:{8:"backspace",9:"tab",13:"return",19:"pause",27:"escape",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",44:"printscreen",45:"insert",46:"delete",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12",144:"numlock",145:"scrolllock"},PRINTABLE_KEYS:{32:" ",
-48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",59:";",61:"=",65:"a",66:"b",67:"c",68:"d",69:"e",70:"f",71:"g",72:"h",73:"i",74:"j",75:"k",76:"l",77:"m",78:"n",79:"o",80:"p",81:"q",82:"r",83:"s",84:"t",85:"u",86:"v",87:"w",88:"x",89:"y",90:"z",107:"+",109:"-",110:".",188:",",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:'"'},PRINTABLE_KEYS_CHARCODE:{},KEY:{}};for(var h in l.PRINTABLE_KEYS){var d=l.PRINTABLE_KEYS[h];l.PRINTABLE_KEYS_CHARCODE[d.charCodeAt(0)]=h;if(d.toUpperCase()!=
-d)l.PRINTABLE_KEYS_CHARCODE[d.toUpperCase().charCodeAt(0)]=h}for(h in l.FUNCTION_KEYS){d=l.FUNCTION_KEYS[h].toUpperCase();l.KEY[d]=parseInt(h,10)}return l}();var r=function(l){return!!(l.altKey||l.ctrlKey||l.metaKey||l.charCode!==l.which&&s.KeyHelper.FUNCTION_KEYS[l.which])};s.commandCodes=function(l,h){var d=l._keyCode||l.keyCode,f=l._charCode===undefined?l.charCode:l._charCode,m=null,i=null,g="",j=true;if(d===0&&l.which===0)return false;if(f!==0)return false;if(s.KeyHelper.MODIFIER_KEYS[f])return[s.KeyHelper.MODIFIER_KEYS[f],
-null];if(d){m=s.KeyHelper.FUNCTION_KEYS[d];if(!m&&(l.altKey||l.ctrlKey||l.metaKey)){m=s.KeyHelper.PRINTABLE_KEYS[d];if(d>47&&d<58)j=l.altKey}if(m){if(l.altKey)g+="alt_";if(l.ctrlKey)g+="ctrl_";if(l.metaKey)g+="meta_"}else if(l.ctrlKey||l.metaKey)return false}if(!m){d=l.which;i=m=String.fromCharCode(d);d=m.toLowerCase();if(l.metaKey){g="meta_";m=d}else m=null}if(l.shiftKey&&m&&j)g+="shift_";if(m)m=g+m;if(!h&&m)m=m.replace(/ctrl_meta|meta/,"ctrl");return[m,i]};s.addKeyDownListener=function(l,h){var d=
-function(f){var m=h(f);m&&v.stopEvent(f);return m};l.addEventListener("keydown",function(f){if(v.isMozilla)if(s.KeyHelper.FUNCTION_KEYS[f.keyCode])return true;else if((f.ctrlKey||f.metaKey)&&s.KeyHelper.PRINTABLE_KEYS[f.keyCode])return true;if(r(f))return d(f);return true},false);l.addEventListener("keypress",function(f){if(v.isMozilla)if(s.KeyHelper.FUNCTION_KEYS[f.keyCode])return d(f);else if((f.ctrlKey||f.metaKey)&&s.KeyHelper.PRINTABLE_KEYS_CHARCODE[f.charCode]){f._keyCode=s.KeyHelper.PRINTABLE_KEYS_CHARCODE[f.charCode];
-f._charCode=0;return d(f)}if(f.charCode!==undefined&&f.charCode===0)return true;return d(f)},false)}});bespin.tiki.module("keyboard:index",function(){});bespin.tiki.register("::worker_manager",{name:"worker_manager",dependencies:{canon:"0.0.0",events:"0.0.0",underscore:"0.0.0"}});
-bespin.tiki.module("worker_manager:index",function(y,s){function v(g){var j=/^([^#:]+)(?::([^#:]+))?#([^#:]+)$/.exec(g);if(j==null)throw new Error('WorkerSupervisor: invalid pointer specification: "'+g+'"');g=j[1];var q=j[3];j=g+":"+(j[2]!=null?j[2]:"index");var t=bespin!=null&&bespin.base!=null?bespin.base:"";this._packageId=g;this._moduleId=j;this._base=t;this._target=q;this._worker=null;this._currentId=0;this.started=new f}function r(){i.restartAll()}if(window==null)throw new Error('The "worker_manager" plugin can only be loaded in the browser, not a web worker. Use "worker" instead.');
-var l=y("bespin:proxy");y("bespin:plugins");var h=y("bespin:console").console,d=y("underscore")._,f=y("events").Event,m=y("bespin:promise").Promise;y("environment");var i={_workers:[],add:function(g){this._workers.push(g)},remove:function(g){this._workers=d(this._workers).without(g)},restartAll:function(){var g=this._workers;d(g).invoke("kill");d(g).invoke("start")}};v.prototype={_onError:function(g){this._worker=null;i.remove(this);h.error("WorkerSupervisor: worker failed at file "+g.filename+":"+
-g.lineno+"; fix the worker and use 'worker restart' to restart it")},_onMessage:function(g){g=JSON.parse(g.data);switch(g.op){case "finish":if(g.id===this._currentId){var j=this._promise;this._promise=null;j.resolve(g.result)}break;case "log":h[g.method].apply(h,g.args);break}},_promise:null,started:null,kill:function(){var g=this._promise;if(g!=null){g.reject("killed");this._promise=null}this._worker.terminate();this._worker=null;i.remove(this)},send:function(g,j){var q=this._promise;if(q!=null){q.reject("interrupted");
-this._currentId++}q=this._currentId;var t=new m;this._promise=t;this._worker.postMessage(JSON.stringify({op:"invoke",id:q,method:g,args:j}));return t},start:function(){if(this._worker!=null)throw new Error("WorkerSupervisor: worker already started");var g=this._base,j=this._target,q=this._packageId,t=this._moduleId,B=new l.Worker(g+"BespinEmbedded.js");B.onmessage=this._onMessage.bind(this);B.onerror=this._onError.bind(this);B.postMessage(JSON.stringify({op:"load",base:g,pkg:q,module:t,target:j}));
-this._worker=B;this._currentId=0;i.add(this);this.started()}};s.WorkerSupervisor=v;s.workerManager=i;s.workerRestartCommand=r});bespin.tiki.register("::edit_session",{name:"edit_session",dependencies:{events:"0.0.0"}});
-bespin.tiki.module("edit_session:index",function(y,s){y("bespin:promise");y("bespin:plugins");y("bespin:util/util");y("events");s.EditSession=function(){};s.EditSession.prototype={_currentView:null,currentUser:null,history:null,getCompletePath:function(v){if(v==null)v="";if(v==null||v.substring(0,1)!="/"){var r;if(this._currentView&&this._currentView.buffer)r=this._currentView.buffer;var l;if(r)l=r.file;v=l?l.parentdir()+v:"/"+v}return v}};Object.defineProperties(s.EditSession.prototype,{currentView:{set:function(v){if(v!==
-this._currentView)this._currentView=v},get:function(){return this._currentView}}});s.createSession=function(v,r){var l=new s.EditSession;if(v)l.currentView=v.textView;if(r)l.currentUser=r;return l}});bespin.tiki.register("::syntax_manager",{name:"syntax_manager",dependencies:{worker_manager:"0.0.0",events:"0.0.0",underscore:"0.0.0",syntax_directory:"0.0.0"}});
-bespin.tiki.module("syntax_manager:index",function(y,s){function v(g,j,q,t){for(;g.length<j;)g.push(d(t).clone());j=[j,q.length].concat(q);Array.prototype.splice.apply(g,j);return g}function r(){this._lines=[];this._syms={}}function l(g,j){this._syntaxInfo=g;this._syntaxManager=j;this._invalidRow=0;this._states=[];this._active=false;this.symbols=new r}function h(g){this.layoutManager=g;this.attrsChanged=new f;this.syntaxChanged=new f;this._contextRanges=this._invalidRows=this._context=null;this._attrs=
-[];this._symbols=new r;this._syntax="plain";this._reset()}var d=y("underscore")._,f=y("events").Event,m=y("worker_manager").WorkerSupervisor;y("bespin:console");y("rangeutils:utils/range");var i=y("syntax_directory").syntaxDirectory;r.prototype={get:function(g){return this._syms["-"+g]},replaceLine:function(g,j){function q(C){return C.substring(1)}var t=this._lines,B=this._syms;g<t.length&&d(t[g]).isArray()&&d(t[g]).each(function(C){delete B["-"+C]});t[g]=d(j).keys().map(q);d(B).extend(j)}};l.prototype=
-{_annotate:function(){if(this._invalidRow==null)throw new Error("syntax_manager.Context: attempt to annotate without any invalid row");if(!this._active)throw new Error("syntax_manager.Context: attempt to annotate while inactive");if(this._worker==null)this._createWorker();else{var g=this._syntaxManager.getTextLines(),j=this._invalidRow,q=j===0?this.getName()+":start":this._states[j],t=Math.min(g.length,j+100);g=g.slice(j,t);var B={start:{row:j,col:0},end:{row:t-1,col:d(g).last().length}};this._worker.send("annotate",
-[q,g,B]).then(d(this._annotationFinished).bind(this,j,t))}},_annotationFinished:function(g,j,q){if(this._active){var t=this._syntaxManager;t.mergeAttrs(g,q.attrs);t.mergeSymbols(g,q.symbols);v(this._states,g,q.states);if(j>=this._getRowCount()){this._invalidRow=null;this._active=false}else{this._invalidRow=j;this._annotate()}}},_createWorker:function(){if(this._syntaxInfo==null)return false;var g=new m("syntax_worker#syntaxWorker");this._worker=g;g.started.add(this._workerStarted.bind(this));g.start();
-return true},_getRowCount:function(){return this._syntaxManager.getTextLines().length},_workerStarted:function(){this._worker.send("loadSyntax",[this._syntaxInfo.name]);this._active&&this._annotate()},activateAndAnnotate:function(){this._active=true;this._annotate()},contextsAtPosition:function(){var g=this._syntaxInfo;if(g==null)return["plain"];return[g.name]},cut:function(g){var j=this._getRowCount();if(g<0||g>=j)throw new Error("Attempt to cut the context at an invalid row");if(!(this._invalidRow!=
-null&&this._invalidRow<g)){this._invalidRow=g;this._active=false}},getName:function(){return this._syntaxInfo.name},kill:function(){var g=this._worker;if(g!=null){g.kill();this._worker=null}}};h.prototype={_getTextStorage:function(){return this.layoutManager.textStorage},_reset:function(){var g=this._context;if(g!=null){g.kill();this._context=null}g=this._syntax;g=g==="plain"?null:i.get(g);this._context=g=new l(g,this);g.activateAndAnnotate()},attrsChanged:null,syntaxChanged:null,contextsAtPosition:function(g){return this._context.contextsAtPosition(g)},
-getAttrsForRows:function(g,j){return this._attrs.slice(g,j)},getSymbol:function(g){return this._symbols.get(g)},getSyntax:function(){return this._syntax},getTextLines:function(){return this._getTextStorage().lines},invalidateRow:function(g){var j=this._context;j.cut(g);j.activateAndAnnotate()},mergeAttrs:function(g,j){v(this._attrs,g,j,[]);this.attrsChanged(g,g+j.length)},mergeSymbols:function(g,j){var q=this._symbols;d(j).each(function(t,B){q.replaceLine(g+B,t)})},setSyntax:function(g){this._syntax=
-i.hasSyntax(g)?g:"plain";this.syntaxChanged(g);this._reset()},setSyntaxFromFileExt:function(g){return this.setSyntax(i.syntaxForFileExt(g))}};s.SyntaxManager=h});bespin.tiki.register("::completion",{name:"completion",dependencies:{jquery:"0.0.0",ctags:"0.0.0",rangeutils:"0.0.0",canon:"0.0.0",underscore:"0.0.0"}});
-bespin.tiki.module("completion:controller",function(y,s){function v(i){this._editorView=i;i.selectionChanged.add(this._selectionChanged.bind(this));i.willChangeBuffer.add(this._willChangeBuffer.bind(this));this._syntaxChanged=this._syntaxChanged.bind(this);this.tags=new l.Tags;this.ui=new d(i.element)}function r(i){return function(){return m.editor.completionController[i](m)}}var l=y("ctags"),h=y("rangeutils:utils/range"),d=y("completion:ui").CompletionUI,f=y("bespin:plugins").catalog,m=y("environment").env;
-v.prototype={_buffer:null,_completionEngine:null,_completions:null,_stem:null,_hideCompletions:function(){this.ui.hide()},_selectionChanged:function(i){var g=this._completionEngine;if(!(g==null||!h.isZeroLength(i))){var j=this._buffer.layoutManager,q=j.syntaxManager,t=i.start;i=t.col;t=j.textStorage.lines[t.row];j=t.substring(0,i);i=t.substring(i);g=g.getCompletions(j,i,q);if(g==null)this._hideCompletions();else{q=g.tags;this._stem=g.stem;this._showCompletions(q)}}},_showCompletions:function(i){var g=
-this._editorView,j=g.textView.getInsertionPointPosition();j=g.convertTextViewPoint(j);this.ui.show(i,j,g.layoutManager.fontDimension.lineHeight)},_syntaxChanged:function(i){i=f.getExtensionByKey("completion",i);if(i==null)this._completionEngine=null;else i.load().then(function(g){this._completionEngine=new g(this.tags)}.bind(this))},_willChangeBuffer:function(i){var g=this._buffer;g!=null&&g.layoutManager.syntaxManager.syntaxChanged.remove(this._syntaxChanged);i.layoutManager.syntaxManager.syntaxChanged.add(this._syntaxChanged);
-this._buffer=i},cancel:function(){this.ui.hide()},complete:function(i){var g=this.ui,j=g.getCompletion().name;i.view.insertText(j.substring(this._stem.length));g.hide()},isCompleting:function(){return this.ui.visible},moveDown:function(){this.ui.move("down")},moveUp:function(){this.ui.move("up")},tags:null};s.CompletionController=v;s.completeCommand=r("complete");s.completeCancelCommand=r("cancel");s.completeDownCommand=r("moveDown");s.completeUpCommand=r("moveUp")});
-bespin.tiki.module("completion:ui",function(y,s){function v(m){var i=l.uniqueId("bespin-completion-panel"),g=document.createElement("div");g.id=i;g.className="bespin-completion-panel";g.style.display="none";g.innerHTML='<div class="bespin-completion-pointer"></div><div class="bespin-completion-bubble-outer"><div class="bespin-completion-bubble-inner"><div class="bespin-completion-highlight"></div><ul></ul></div></div>';r(m).append(g);this.panel=r(g);this.parent=r(m)}var r=y("jquery").$,l=y("underscore")._,
-h=l.template('<span class="bespin-completion-container"> — <%= container %></span>'),d=l.template('<div class="bespin-completion-second-row"><%= type %></div>'),f=l.template('<li><div class="bespin-completion-top-row"><span class="bespin-completion-kind bespin-completion-kind-<%= kind %>"><%= kind %></span><span class="bespin-completion-ident"><%= ident %></span><%= container %></div><%= second_row %></li>');v.prototype={_fromBottom:false,_index:0,_tags:null,_getHighlightDimensions:function(m){var i=
-m.position(),g=m.outerHeight()-2;m=m.outerWidth()-2;return{left:i.left,top:i.top,height:g,width:m}},_listItemForIndex:function(m){return this.panel.find("li:eq("+m+")")},_populate:function(){var m=l(this._tags).map(function(i){var g=i["class"],j=i.module,q=i.namespace;g=g!=null?g:q!=null?q:"";if(j!=null)g=j+(g!=""?"#"+g:"");j=g==""?"":h({container:g});g=i.type;g=g==null?"":d({type:g});return f({kind:i.kind,ident:i.name,container:j,second_row:g})});this.panel.find("ul").html(m.join("\n"))},panel:null,
-visible:false,getCompletion:function(){return this.visible?this._tags[this._index]:null},hide:function(){if(this.visible){this.panel.fadeOut(100);this.visible=false}},move:function(m){var i=this._index,g=this._listItemForIndex(i),j=m==="up"?g.prev():g.next();if(j.length!==0){this._index=i=m==="up"?i-1:i+1;i=r(g).find(".bespin-completion-top-row");var q=r(g).find(".bespin-completion-second-row");g=r(j).find(".bespin-completion-top-row");var t=r(j).find(".bespin-completion-second-row");q.hide();t.show();
-var B=this.panel.find(".bespin-completion-highlight");B.stop(true,true);j=this._getHighlightDimensions(j);B.animate(j,100);t.hide();if(m==="down"){m=q.height();g.css("top",m);g.animate({top:0},100)}else{m=t.height();i.css("top",-m);i.animate({top:0},100)}t.fadeIn()}},show:function(m,i,g){this._tags=m=l(m).clone();this._populate();var j=this.visible,q=this.panel;q.stop(true,true);j||q.show();var t=this.parent.offset(),B=t.left,C=B+i.x,e=t.top+i.y;t=q.outerWidth();var K=q.outerHeight(),L=r(window).width(),
-n=r(window).height();this._fromBottom=e=e+K+g>n;if(this._index>=m.length)this._index=m.length-1;if(e){e=q.find(".bespin-completion-pointer");e.removeClass("bespin-completion-pointer-up");e.addClass("bespin-completion-pointer-down");q.css({bottom:-i.y,top:""});this._tags.reverse();this._populate();if(!j)this._index=m.length-1}else{e=q.find(".bespin-completion-pointer");e.removeClass("bespin-completion-pointer-down");e.addClass("bespin-completion-pointer-up");q.css({top:i.y+g,bottom:""});if(!j)this._index=
-0}if(!j){if(C+i.x+t>L){e.css({left:"",right:32});q.css("left",Math.min(L-t-B,i.x-t+43))}else{e.css({left:32,right:""});q.css("left",Math.max(B,i.x-43))}q.hide().animate({opacity:"show"},100)}m=q.find(".bespin-completion-highlight");m.stop(true,true);i=this._listItemForIndex(this._index);i.find(".bespin-completion-second-row").show();i=this._getHighlightDimensions(i);m.css(i);this.visible=true}};s.CompletionUI=v});bespin.tiki.module("completion:index",function(){});
-bespin.tiki.register("::rangeutils",{name:"rangeutils",dependencies:{}});
-bespin.tiki.module("rangeutils:utils/range",function(y,s){var v=y("bespin:util/util");s.addPositions=function(r,l){return{row:r.row+l.row,col:r.col+l.col}};s.cloneRange=function(r){var l=r.start;r=r.end;return{start:{row:l.row,col:l.col},end:{row:r.row,col:r.col}}};s.comparePositions=function(r,l){var h=r.row-l.row;return h===0?r.col-l.col:h};s.equal=function(r,l){return s.comparePositions(r.start,l.start)===0&&s.comparePositions(r.end,l.end)===0};s.extendRange=function(r,l){var h=r.end;return{start:r.start,
-end:{row:h.row+l.row,col:h.col+l.col}}};s.intersectRangeSets=function(r,l){r=v.clone(r);l=v.clone(l);for(var h=[];r.length>0&&l.length>0;){var d=r.shift(),f=l.shift(),m=s.comparePositions(d.start,f.start),i=s.comparePositions(d.end,f.end);if(s.comparePositions(d.end,f.start)<0){h.push(d);l.unshift(f)}else if(s.comparePositions(f.end,d.start)<0){h.push(f);r.unshift(d)}else if(m<0){h.push({start:d.start,end:f.start});r.unshift({start:f.start,end:d.end});l.unshift(f)}else if(m===0)if(i<0)l.unshift({start:d.end,
-end:f.end});else i>0&&r.unshift({start:f.end,end:d.end});else if(m>0){h.push({start:f.start,end:d.start});r.unshift(d);l.unshift({start:d.start,end:f.end})}}return h.concat(r,l)};s.isZeroLength=function(r){return r.start.row===r.end.row&&r.start.col===r.end.col};s.maxPosition=function(r,l){return s.comparePositions(r,l)>0?r:l};s.normalizeRange=function(r){return this.comparePositions(r.start,r.end)<0?r:{start:r.end,end:r.start}};s.rangeSetBoundaries=function(r){return{start:r[0].start,end:r[r.length-
-1].end}};s.toString=function(r){var l=r.start;r=r.end;return"[ "+l.row+", "+l.col+" "+r.row+","+ +r.col+" ]"};s.unionRanges=function(r,l){return{start:r.start.row<l.start.row||r.start.row===l.start.row&&r.start.col<l.start.col?r.start:l.start,end:r.end.row>l.end.row||r.end.row===l.end.row&&r.end.col>l.end.col?r.end:l.end}};s.isPosition=function(r){return!v.none(r)&&!v.none(r.row)&&!v.none(r.col)};s.isRange=function(r){return!v.none(r)&&s.isPosition(r.start)&&s.isPosition(r.end)}});
-bespin.tiki.module("rangeutils:index",function(){});bespin.tiki.register("::undomanager",{name:"undomanager",dependencies:{}});
-bespin.tiki.module("undomanager:index",function(y,s){var v=y("bespin:util/util");y("environment");s.UndoManager=function(){};v.mixin(s.UndoManager.prototype,{_redoStack:[],_undoStack:[],_undoOrRedo:function(r,l,h){if(l.length===0)return false;l=l.pop();if(!l.target[r](l.context)){this._redoStack=[];this._undoStack=[];return false}h.push(l);return true},redo:function(){return this._undoOrRedo("redo",this._redoStack,this._undoStack)},registerUndo:function(r,l){this._redoStack=[];this._undoStack.push({target:r,
-context:l})},undo:function(){return this._undoOrRedo("undo",this._undoStack,this._redoStack)}});s.global=new s.UndoManager;s.undoManagerCommand=function(r,l){s.global[l.commandExt.name]()}});bespin.tiki.register("::environment",{name:"environment",dependencies:{settings:"0.0.0"}});
-bespin.tiki.module("environment:index",function(y,s){var v=y("bespin:util/util"),r=y("bespin:console").console,l=y("bespin:plugins").catalog,h=y("settings").settings;s.Environment=function(){this.commandLine=null;window.addEventListener("resize",this.dimensionsChanged.bind(this),false)};Object.defineProperties(s.Environment.prototype,{settings:{value:{set:function(d,f){if(v.none(d))throw new Error("setSetting(): key must be supplied");if(v.none(f))throw new Error("setSetting(): value must be supplied");
-h.set(d,f)},get:function(d){if(v.none(d))throw new Error("getSetting(): key must be supplied");return h.get(d)}}},dimensionsChanged:{value:function(){l.publish(this,"dimensionsChanged")}},session:{get:function(){return l.getObject("session")}},view:{get:function(){if(!this.session)return null;return this.session.currentView}},editor:{get:function(){if(!this.session)return null;return this.session.currentView.editor}},contexts:{get:function(){if(!this.view)return[];var d=this.view.editor.layoutManager.syntaxManager,
-f=this.view.getSelectedRange().start;return d.contextsAtPosition(f)}},buffer:{get:function(){if(this.session)return this.view.editor.buffer;else r.error("command attempted to get buffer but there's no session")}},model:{get:function(){if(this.buffer)return this.view.editor.layoutManager.textStorage;else r.error("Session has no current buffer")}},file:{get:function(){if(this.buffer)return this.buffer.file;else r.error("Session has no current buffer")}},files:{get:function(){return l.getObject("files")}}});
-s.env=new s.Environment});bespin.tiki.register("::ctags",{name:"ctags",dependencies:{traits:"0.0.0",underscore:"0.0.0"}});
-bespin.tiki.module("ctags:index",function(y,s){var v=y("underscore")._,r=y("./reader").TagReader;y=y("traits").Trait;s.Tags=function(){this.tags=[]};s.Tags.prototype=Object.create(Object.prototype,y.compose(y({_search:function(l,h){var d={name:l};l=this.tags;var f=v(l).sortedIndex(d,function(m){return m.name});for(f=d=f;d>=0&&d<l.length&&h(l[d]);)d--;for(;f>=0&&f<l.length&&h(l[f]);)f++;return l.slice(d+1,f)},add:function(l){var h=this.tags;Array.prototype.push.apply(h,l);h.sort(function(d,f){d=d.name;
-f=f.name;if(d<f)return-1;if(d===f)return 0;return 1})},get:function(l){return this._search(l,function(h){return h.name===l})},scan:function(l,h,d){if(d===null||d===undefined)d={};var f=l.split("\n");l=parse(l,h,1);h=new Interpreter(l,h,f,d);h.interpret();this.add(h.tags)},stem:function(l){var h=l.length;return this._search(l,function(d){return d.name.substring(0,h)===l})}}),r))});
-bespin.tiki.module("ctags:reader",function(y,s){var v=y("underscore")._;y=y("traits").Trait;s.TagReader=y({readLines:function(r){var l=[];v(r).each(function(h){h=h.split("\t");if(!(h.length<3)){var d=h[0];if(!/^!_TAG_/.test(d)){d={name:d,tagfile:h[1],addr:h[2]};var f;if(h.length>3&&h[3].indexOf(":")===-1){d.kind=h[3];f=4}else f=3;var m={};v(h.slice(f)).each(function(i){i=/^([^:]+):(.*)/.exec(i);m[i[1]]=i[2]});d.fields=m;l.push(d)}}});this.add(l)},readString:function(r){this.readLines(r.split("\n"))}})});
-bespin.tiki.register("::theme_manager",{name:"theme_manager",dependencies:{theme_manager_base:"0.0.0",settings:"0.0.0",events:"0.0.0",less:"0.0.0"}});
-bespin.tiki.module("theme_manager:index",function(y,s){y("bespin:promise");var v=y("bespin:plugins").catalog;y("events");var r=y("themestyles"),l=y("settings").settings,h=null,d=null;s.themestyles=r;s.themeSettingChanged=function(f,m,i){var g=v.getExtensionByKey("theme",i);if(i==="standard"||!i||!g){g=null;if(d!==null)g=v.getExtensionByKey("theme",d)}if(g)g.load().then(function(j){h&&r.unregisterThemeStyles(h);r.currentThemeVariables=j();h=g;r.parseGlobalVariables();r.reparse();g.url&&r.registerThemeStyles(g);
-v.publish(s,"themeChange")});else if(h){r.unregisterThemeStyles(h);h=null;r.currentThemeVariables=null;r.parseGlobalVariables();r.reparse();v.publish(this,"themeChange")}};v.registerExtension("settingChange",{match:"theme",pointer:s.themeSettingChanged.bind(s)});s.setStandardTheme=function(f){d=f;f!==l.get("theme")&&s.themeSettingChanged(this)};s.setBasePlugin=function(f){r.basePluginName=f};s.startParsing=function(){r.preventParsing=false;return r.reparse()};s.registerTheme=function(f){var m=l.get("theme");
-f.name===m&&s.themeSettingChanged(this,"theme",f.name)};s.unregisterTheme=function(f){f.name===l.get("theme")&&s.themeSettingChanged(this)};s.appLaunched=function(){v.publish(s,"themeChange")}});
-bespin.tiki.module("theme_manager:themestyles",function(y,s){var v=y("bespin:util/util"),r=y("bespin:plugins").catalog,l=y("bespin:console").console,h=y("bespin:promise").Promise,d=y("bespin:promise").group,f=y("bespin:proxy"),m=new (y("less").Parser)({optimization:3}),i=1;s.currentThemeVariables=null;s.basePluginName=null;s.preventParsing=true;var g="";s.globalThemeVariables={};var j={},q={},t=function(w){var D={},J=[],Q=function(Z,T){J.push(Z);if(typeof T!="object")D[J.join("_")]=T;else for(prop in T)Q(prop,
-T[prop]);J.pop()};Q("global",w);return D},B={},C={font:"arial, lucida, helvetica, sans-serif",font_size:"14px",line_height:"1.8em",color:"#DAD4BA",text_shadow:"1px 1px rgba(0, 0, 0, 0.4)",error_color:"#F99",header_color:"white",link_color:"#ACF",control:{color:"#E1B41F",border:"1px solid rgba(0, 0, 0, 0.2)",border_radius:"0.25em",background:"rgba(0, 0, 0, 0.2)",active:{color:"#FF9600",border:"1px solid #E1B41F",inset_color:"#ff9600",background:"rgba(0, 0, 0, 0.2)"}},pane:{h1:{font:"'MuseoSans', Helvetica",
-font_size:"2.8em",color:"white"},color:"#DAD4BA",text_shadow:"1px 1px rgba(0, 0, 0, 0.4)",link_color:"white",background:"#45443C",border_radius:".5em"},form:{color:"white",text_shadow:"1px 1px rgba(0, 0, 0, 0.4)",font:"'Lucida Sans','Lucida Grande',Verdana,Arial,sans-serif",font_size:"@global_font_size",line_height:"@global_line_height"},button:{color:"white",background:"#3E6CB9"},container:{background:"#1E1916",border:"1px solid black"},selectable:{color:"white",border:"0px solid transparent",background:"transparent",
-active:{color:"black",border:"0px solid transparent",background:"#FF8E00"},hover:{color:"black",border:"0px solid transparent",background:"#FF8E00"}},hint:{color:"#AAA",active:{color:"black"},hover:{color:"black"}},accelerator:{color:"#996633",active:{color:"black"},hover:{color:"black"}},menu:{border_color:"black",inset_color_right:"#1E1916",inset_color_top_left:"#3E3936",background:"transparent"}};C=t(C);s.getPluginThemeVariables=function(w){var D=r.plugins[w];if(!D)return null;var J={};if(s.currentThemeVariables&&
-s.currentThemeVariables[w])J=s.currentThemeVariables[w];D.provides.forEach(function(Q){if(Q.ep==="themevariable"){var Z=Q.name;J[Z]=J[Z]||Q.defaultValue}});return J};s.parseGlobalVariables=function(){var w={},D="",J=s.currentThemeVariables;v.mixin(w,C);J&&J.global&&v.mixin(w,t(J.global));s.globalThemeVariables=w;for(prop in w)D+="@"+prop+":"+w[prop]+";";g=D};s.parseGlobalVariables();var e=function(w,D,J){if(j[D])styleElem=document.getElementById("_bespin_theme_style_"+j[D]);else{styleElem=document.createElement("style");
-styleElem.setAttribute("id","_bespin_theme_style_"+i);j[D]=i;i++;document.body.appendChild(styleElem)}m.parse(g+J+q[D],function(Q,Z){if(Q){Q="Error less parsing "+D+" "+Q.message;l.error(Q);w.reject(Q)}else{try{var T=Z.toCSS()}catch(ca){Q="Error less parsing "+D+" "+ca;l.error(Q);w.reject(Q);return}if(styleElem&&styleElem.firstChild)styleElem.firstChild.textContent=T;else{Q=document.createTextNode(T);styleElem.appendChild(Q)}w.resolve()}})},K={};s.parsePlugin=function(w){if(s.preventParsing)return(new h).resolve();
-var D=r.plugins[w];if(!D)throw"reparsePlugin: plugin "+w+" is not defined!";if(!K[w]){K[w]=new h;setTimeout(function(){var J=s.getPluginThemeVariables(w),Q="";for(prop in J)Q+="@"+prop+":"+J[prop]+";";J=new h;J.then(function(Z){K[this.name].resolve(Z);K[this.name]=null}.bind(this),function(){K[this.name].reject(data);K[this.name]=null}.bind(this));e(J,w,Q)}.bind(D),0)}return K[w]};var L=function(w,D,J,Q){J=J.replace(/url\(['"]*([^'")]*)(['"]*)\)/g,"url("+w+"$1)");q[D]+=J;Q&&Q.resolve()},n=null;s.registerThemeStyles=
-function(w){var D=w.getPluginName(),J=r.getResourceURL(D);if(!(w.url instanceof Array))w.url=[w.url];q[D]="";var Q=[],Z=s.preventParsing;w.url.forEach(function(T){if(B[D]&&B[D][T])L(J,D,B[D][T]);else{var ca=new h;Q.push(ca);var ha=J+T+"?"+(new Date).getTime();f.xhr("GET",ha,true,function(ga){ga.overrideMimeType("text/plain")}).then(function(ga){L(J,D,ga,ca)},function(){l.error("registerLessFile: Could not load "+J+T);ca.resolve()})}});if(Q.length===0)s.parsePlugin(D);else{Z||d(Q).then(function(){s.parsePlugin(D)});
-if(n!==null)Q=Q.concat(n);n=d(Q)}};s.reparse=function(){var w=new h;if(s.preventParsing)return w.resolve();n?n.then(function(){var D=[],J=s.basePluginName;J!==null&&q[J]&&D.push(s.parsePlugin(J));for(var Q in q)Q!==J&&D.push(s.parsePlugin(Q));d(D).then(w.resolve.bind(w),w.reject.bind(w))},function(D){w.reject(D)}):w.resolve();return w};s.unregisterThemeStyles=function(w){w=w.getPluginName();if(j[w]){var D=document.getElementById("_bespin_theme_style_"+j[w]);D.parentNode.removeChild(D);delete j[w];
-delete q[w]}}});bespin.tiki.register("::types",{name:"types",dependencies:{}});
-bespin.tiki.module("types:basic",function(y,s){var v=y("bespin:plugins").catalog,r=y("bespin:console").console,l=y("bespin:promise").Promise;s.text={isValid:function(h){return typeof h=="string"},toString:function(h){return h},fromString:function(h){return h}};s.number={isValid:function(h){if(isNaN(h))return false;if(h===null)return false;if(h===undefined)return false;if(h===Infinity)return false;return typeof h=="number"},toString:function(h){if(!h)return null;return""+h},fromString:function(h){if(!h)return null;
-var d=parseInt(h,10);if(isNaN(d))throw new Error("Can't convert \""+h+'" to a number.');return d}};s.bool={isValid:function(h){return typeof h=="boolean"},toString:function(h){return""+h},fromString:function(h){if(h===null)return null;if(!h.toLowerCase)return!!h;var d=h.toLowerCase();if(d=="true")return true;else if(d=="false")return false;return!!h}};s.object={isValid:function(h){return typeof h=="object"},toString:function(h){return JSON.stringify(h)},fromString:function(h){return JSON.parse(h)}};
-s.selection={isValid:function(h,d){if(typeof h!="string")return false;if(!d.data){r.error("Missing data on selection type extension. Skipping");return true}var f=false;d.data.forEach(function(m){if(h==m)f=true});return f},toString:function(h){return h},fromString:function(h){return h},resolveTypeSpec:function(h,d){var f=new l;if(d.data){h.data=d.data;f.resolve()}else if(d.pointer)v.loadObjectForPropertyPath(d.pointer).then(function(m){m=m(d);if(typeof m.then==="function")m.then(function(i){h.data=
-i;f.resolve()});else{h.data=m;f.resolve()}},function(m){f.reject(m)});else{r.warn("Missing data/pointer for selection",d);f.resolve()}return f}}});
-bespin.tiki.module("types:types",function(y,s){function v(d){var f=new h,m=l.getExtensionByKey("type",d.name);m?f.resolve({ext:m,typeSpec:d}):f.reject(new Error("Unknown type: "+d.name));return f}function r(d){if(typeof d==="string")return v({name:d});if(typeof d==="object")if(d.name==="deferred"){var f=new h;s.undeferTypeSpec(d).then(function(m){r(m).then(function(i){f.resolve(i)},function(i){f.reject(i)})});return f}else return v(d);throw new Error("Unknown typeSpec type: "+typeof d);}var l=y("bespin:plugins").catalog;
-y("bespin:console");var h=y("bespin:promise").Promise;s.getSimpleName=function(d){if(!d)throw new Error("null|undefined is not a valid typeSpec");if(typeof d=="string")return d;if(typeof d=="object"){if(!d.name)throw new Error("Missing name member to typeSpec");return d.name}throw new Error("Not a typeSpec: "+d);};s.equals=function(d,f){return s.getSimpleName(d)==s.getSimpleName(f)};s.undeferTypeSpec=function(d){var f=new h;if(!d.pointer){f.reject(new Error("Missing deferred pointer"));return f}l.loadObjectForPropertyPath(d.pointer).then(function(m){m=
-m(d);typeof m.then==="function"?m.then(function(i){f.resolve(i)},function(i){f.reject(i)}):f.resolve(m)},function(m){f.reject(m)});return f};s.resolveType=function(d){var f=new h;r(d).then(function(m){m.ext.load(function(i){typeof i.resolveTypeSpec==="function"?i.resolveTypeSpec(m.ext,m.typeSpec).then(function(){f.resolve({type:i,ext:m.ext})},function(g){f.reject(g)}):f.resolve({type:i,ext:m.ext})})},function(m){f.reject(m)});return f};s.fromString=function(d,f){var m=new h;s.resolveType(f).then(function(i){m.resolve(i.type.fromString(d,
-i.ext))});return m};s.toString=function(d,f){var m=new h;s.resolveType(f).then(function(i){m.resolve(i.type.toString(d,i.ext))});return m};s.isValid=function(d,f){var m=new h;s.resolveType(f).then(function(i){m.resolve(i.type.isValid(d,i.ext))});return m}});bespin.tiki.module("types:index",function(){});bespin.tiki.register("::jquery",{name:"jquery",dependencies:{}});
-bespin.tiki.module("jquery:index",function(y,s){function v(){if(!e.isReady){try{n.documentElement.doScroll("left")}catch(a){setTimeout(v,1);return}e.ready()}}function r(a,b){b.src?e.ajax({url:b.src,async:false,dataType:"script"}):e.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}function l(a,b,k,p,o,z){var A=a.length;if(typeof b==="object"){for(var I in b)l(a,I,b[I],p,o,k);return a}if(k!==undefined){p=!z&&p&&e.isFunction(k);for(I=0;I<A;I++)o(a[I],b,p?k.call(a[I],
-I,o(a[I],b)):k,z);return a}return A?o(a[0],b):undefined}function h(){return(new Date).getTime()}function d(){return false}function f(){return true}function m(a,b,k){k[0].type=a;return e.event.handle.apply(b,k)}function i(a){var b,k=[],p=[],o=arguments,z,A,I,E,H,R;A=e.data(this,"events");if(!(a.liveFired===this||!A||!A.live||a.button&&a.type==="click")){a.liveFired=this;var W=A.live.slice(0);for(E=0;E<W.length;E++){A=W[E];A.origType.replace(sa,"")===a.type?p.push(A.selector):W.splice(E--,1)}z=e(a.target).closest(p,
-a.currentTarget);H=0;for(R=z.length;H<R;H++)for(E=0;E<W.length;E++){A=W[E];if(z[H].selector===A.selector){I=z[H].elem;p=null;if(A.preType==="mouseenter"||A.preType==="mouseleave")p=e(a.relatedTarget).closest(A.selector)[0];if(!p||p!==I)k.push({elem:I,handleObj:A})}}H=0;for(R=k.length;H<R;H++){z=k[H];a.currentTarget=z.elem;a.data=z.handleObj.data;a.handleObj=z.handleObj;if(z.handleObj.origHandler.apply(z.elem,o)===false){b=false;break}}return b}}function g(a,b){return"live."+(a&&a!=="*"?a+".":"")+
-b.replace(/\./g,"`").replace(/ /g,"&")}function j(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function q(a,b){var k=0;b.each(function(){if(this.nodeName===(a[k]&&a[k].nodeName)){var p=e.data(a[k++]),o=e.data(this,p);if(p=p&&p.events){delete o.handle;o.events={};for(var z in p)for(var A in p[z])e.event.add(this,z,p[z][A],p[z][A].data)}}})}function t(a,b,k){var p,o,z;b=b&&b[0]?b[0].ownerDocument||b[0]:n;if(a.length===1&&typeof a[0]==="string"&&a[0].length<512&&b===n&&!Ha.test(a[0])&&(e.support.checkClone||
-!Ia.test(a[0]))){o=true;if(z=e.fragments[a[0]])if(z!==1)p=z}if(!p){p=b.createDocumentFragment();e.clean(a,b,p,k)}if(o)e.fragments[a[0]]=z?p:1;return{fragment:p,cacheable:o}}function B(a,b){var k={};e.each(Ja.concat.apply([],Ja.slice(0,b)),function(){k[this]=a});return k}function C(a){return"scrollTo"in a&&a.document?a:a.nodeType===9?a.defaultView||a.parentWindow:false}var e=function(a,b){return new e.fn.init(a,b)},K=window.jQuery,L=window.$,n=window.document,w,D=/^[^<]*(<[\w\W]+>)[^>]*$|^#([\w-]+)$/,
-J=/^.[^:#\[\.,]*$/,Q=/\S/,Z=/^(\s|\u00A0)+|(\s|\u00A0)+$/g,T=/^<(\w+)\s*\/?>(?:<\/\1>)?$/;y=navigator.userAgent;var ca=false,ha=[],ga,la=Object.prototype.toString,ma=Object.prototype.hasOwnProperty,na=Array.prototype.push,O=Array.prototype.slice,P=Array.prototype.indexOf;e.fn=e.prototype={init:function(a,b){var k,p;if(!a)return this;if(a.nodeType){this.context=this[0]=a;this.length=1;return this}if(a==="body"&&!b){this.context=n;this[0]=n.body;this.selector="body";this.length=1;return this}if(typeof a===
-"string")if((k=D.exec(a))&&(k[1]||!b))if(k[1]){p=b?b.ownerDocument||b:n;if(a=T.exec(a))if(e.isPlainObject(b)){a=[n.createElement(a[1])];e.fn.attr.call(a,b,true)}else a=[p.createElement(a[1])];else{a=t([k[1]],[p]);a=(a.cacheable?a.fragment.cloneNode(true):a.fragment).childNodes}return e.merge(this,a)}else{if(b=n.getElementById(k[2])){if(b.id!==k[2])return w.find(a);this.length=1;this[0]=b}this.context=n;this.selector=a;return this}else if(!b&&/^\w+$/.test(a)){this.selector=a;this.context=n;a=n.getElementsByTagName(a);
-return e.merge(this,a)}else return!b||b.jquery?(b||w).find(a):e(b).find(a);else if(e.isFunction(a))return w.ready(a);if(a.selector!==undefined){this.selector=a.selector;this.context=a.context}return e.makeArray(a,this)},selector:"",jquery:"1.4.2",length:0,size:function(){return this.length},toArray:function(){return O.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this.slice(a)[0]:this[a]},pushStack:function(a,b,k){var p=e();e.isArray(a)?na.apply(p,a):e.merge(p,a);p.prevObject=this;
-p.context=this.context;if(b==="find")p.selector=this.selector+(this.selector?" ":"")+k;else if(b)p.selector=this.selector+"."+b+"("+k+")";return p},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady();if(e.isReady)a.call(n,e);else ha&&ha.push(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(O.apply(this,arguments),"slice",O.call(arguments).join(","))},
-map:function(a){return this.pushStack(e.map(this,function(b,k){return a.call(b,k,b)}))},end:function(){return this.prevObject||e(null)},push:na,sort:[].sort,splice:[].splice};e.fn.init.prototype=e.fn;e.extend=e.fn.extend=function(){var a=arguments[0]||{},b=1,k=arguments.length,p=false,o,z,A,I;if(typeof a==="boolean"){p=a;a=arguments[1]||{};b=2}if(typeof a!=="object"&&!e.isFunction(a))a={};if(k===b){a=this;--b}for(;b<k;b++)if((o=arguments[b])!=null)for(z in o){A=a[z];I=o[z];if(a!==I)if(p&&I&&(e.isPlainObject(I)||
-e.isArray(I))){A=A&&(e.isPlainObject(A)||e.isArray(A))?A:e.isArray(I)?[]:{};a[z]=e.extend(p,A,I)}else if(I!==undefined)a[z]=I}return a};e.extend({noConflict:function(a){window.$=L;if(a)window.jQuery=K;return e},isReady:false,ready:function(){if(!e.isReady){if(!n.body)return setTimeout(e.ready,13);e.isReady=true;if(ha){for(var a,b=0;a=ha[b++];)a.call(n,e);ha=null}e.fn.triggerHandler&&e(n).triggerHandler("ready")}},bindReady:function(){if(!ca){ca=true;if(n.readyState==="complete")return e.ready();if(n.addEventListener){n.addEventListener("DOMContentLoaded",
-ga,false);window.addEventListener("load",e.ready,false)}else if(n.attachEvent){n.attachEvent("onreadystatechange",ga);window.attachEvent("onload",e.ready);var a=false;try{a=window.frameElement==null}catch(b){}n.documentElement.doScroll&&a&&v()}}},isFunction:function(a){return la.call(a)==="[object Function]"},isArray:function(a){return la.call(a)==="[object Array]"},isPlainObject:function(a){if(!a||la.call(a)!=="[object Object]"||a.nodeType||a.setInterval)return false;if(a.constructor&&!ma.call(a,
-"constructor")&&!ma.call(a.constructor.prototype,"isPrototypeOf"))return false;var b;for(b in a);return b===undefined||ma.call(a,b)},isEmptyObject:function(a){for(var b in a)return false;return true},error:function(a){throw a;},parseJSON:function(a){if(typeof a!=="string"||!a)return null;a=e.trim(a);if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return window.JSON&&
-window.JSON.parse?window.JSON.parse(a):(new Function("return "+a))();else e.error("Invalid JSON: "+a)},noop:function(){},globalEval:function(a){if(a&&Q.test(a)){var b=n.getElementsByTagName("head")[0]||n.documentElement,k=n.createElement("script");k.type="text/javascript";if(e.support.scriptEval)k.appendChild(n.createTextNode(a));else k.text=a;b.insertBefore(k,b.firstChild);b.removeChild(k)}},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,b,k){var p,
-o=0,z=a.length,A=z===undefined||e.isFunction(a);if(k)if(A)for(p in a){if(b.apply(a[p],k)===false)break}else for(;o<z;){if(b.apply(a[o++],k)===false)break}else if(A)for(p in a){if(b.call(a[p],p,a[p])===false)break}else for(k=a[0];o<z&&b.call(k,o,k)!==false;k=a[++o]);return a},trim:function(a){return(a||"").replace(Z,"")},makeArray:function(a,b){b=b||[];if(a!=null)a.length==null||typeof a==="string"||e.isFunction(a)||typeof a!=="function"&&a.setInterval?na.call(b,a):e.merge(b,a);return b},inArray:function(a,
-b){if(b.indexOf)return b.indexOf(a);for(var k=0,p=b.length;k<p;k++)if(b[k]===a)return k;return-1},merge:function(a,b){var k=a.length,p=0;if(typeof b.length==="number")for(var o=b.length;p<o;p++)a[k++]=b[p];else for(;b[p]!==undefined;)a[k++]=b[p++];a.length=k;return a},grep:function(a,b,k){for(var p=[],o=0,z=a.length;o<z;o++)!k!==!b(a[o],o)&&p.push(a[o]);return p},map:function(a,b,k){for(var p=[],o,z=0,A=a.length;z<A;z++){o=b(a[z],z,k);if(o!=null)p[p.length]=o}return p.concat.apply([],p)},guid:1,proxy:function(a,
-b,k){if(arguments.length===2)if(typeof b==="string"){k=a;a=k[b];b=undefined}else if(b&&!e.isFunction(b)){k=b;b=undefined}if(!b&&a)b=function(){return a.apply(k||this,arguments)};if(a)b.guid=a.guid=a.guid||b.guid||e.guid++;return b},uaMatch:function(a){a=a.toLowerCase();a=/(webkit)[ \/]([\w.]+)/.exec(a)||/(opera)(?:.*version)?[ \/]([\w.]+)/.exec(a)||/(msie) ([\w.]+)/.exec(a)||!/compatible/.test(a)&&/(mozilla)(?:.*? rv:([\w.]+))?/.exec(a)||[];return{browser:a[1]||"",version:a[2]||"0"}},browser:{}});
-y=e.uaMatch(y);if(y.browser){e.browser[y.browser]=true;e.browser.version=y.version}if(e.browser.webkit)e.browser.safari=true;if(P)e.inArray=function(a,b){return P.call(b,a)};w=e(n);if(n.addEventListener)ga=function(){n.removeEventListener("DOMContentLoaded",ga,false);e.ready()};else if(n.attachEvent)ga=function(){if(n.readyState==="complete"){n.detachEvent("onreadystatechange",ga);e.ready()}};(function(){e.support={};var a=n.documentElement,b=n.createElement("script"),k=n.createElement("div"),p="script"+
-h();k.style.display="none";k.innerHTML=" <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";var o=k.getElementsByTagName("*"),z=k.getElementsByTagName("a")[0];if(!(!o||!o.length||!z)){e.support={leadingWhitespace:k.firstChild.nodeType===3,tbody:!k.getElementsByTagName("tbody").length,htmlSerialize:!!k.getElementsByTagName("link").length,style:/red/.test(z.getAttribute("style")),hrefNormalized:z.getAttribute("href")==="/a",opacity:/^0.55$/.test(z.style.opacity),
-cssFloat:!!z.style.cssFloat,checkOn:k.getElementsByTagName("input")[0].value==="on",optSelected:n.createElement("select").appendChild(n.createElement("option")).selected,parentNode:k.removeChild(k.appendChild(n.createElement("div"))).parentNode===null,deleteExpando:true,checkClone:false,scriptEval:false,noCloneEvent:true,boxModel:null};b.type="text/javascript";try{b.appendChild(n.createTextNode("window."+p+"=1;"))}catch(A){}a.insertBefore(b,a.firstChild);if(window[p]){e.support.scriptEval=true;delete window[p]}try{delete b.test}catch(I){e.support.deleteExpando=
-false}a.removeChild(b);if(k.attachEvent&&k.fireEvent){k.attachEvent("onclick",function E(){e.support.noCloneEvent=false;k.detachEvent("onclick",E)});k.cloneNode(true).fireEvent("onclick")}k=n.createElement("div");k.innerHTML="<input type='radio' name='radiotest' checked='checked'/>";a=n.createDocumentFragment();a.appendChild(k.firstChild);e.support.checkClone=a.cloneNode(true).cloneNode(true).lastChild.checked;e(function(){var E=n.createElement("div");E.style.width=E.style.paddingLeft="1px";n.body.appendChild(E);
-e.boxModel=e.support.boxModel=E.offsetWidth===2;n.body.removeChild(E).style.display="none"});a=function(E){var H=n.createElement("div");E="on"+E;var R=E in H;if(!R){H.setAttribute(E,"return;");R=typeof H[E]==="function"}return R};e.support.submitBubbles=a("submit");e.support.changeBubbles=a("change");a=b=k=o=z=null}})();e.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",
-frameborder:"frameBorder"};var S="jQuery"+h(),U=0,aa={};e.extend({cache:{},expando:S,noData:{embed:true,object:true,applet:true},data:function(a,b,k){if(!(a.nodeName&&e.noData[a.nodeName.toLowerCase()])){a=a==window?aa:a;var p=a[S],o=e.cache;if(!p&&typeof b==="string"&&k===undefined)return null;p||(p=++U);if(typeof b==="object"){a[S]=p;o[p]=e.extend(true,{},b)}else if(!o[p]){a[S]=p;o[p]={}}a=o[p];if(k!==undefined)a[b]=k;return typeof b==="string"?a[b]:a}},removeData:function(a,b){if(!(a.nodeName&&
-e.noData[a.nodeName.toLowerCase()])){a=a==window?aa:a;var k=a[S],p=e.cache,o=p[k];if(b){if(o){delete o[b];e.isEmptyObject(o)&&e.removeData(a)}}else{if(e.support.deleteExpando)delete a[e.expando];else a.removeAttribute&&a.removeAttribute(e.expando);delete p[k]}}}});e.fn.extend({data:function(a,b){if(typeof a==="undefined"&&this.length)return e.data(this[0]);else if(typeof a==="object")return this.each(function(){e.data(this,a)});var k=a.split(".");k[1]=k[1]?"."+k[1]:"";if(b===undefined){var p=this.triggerHandler("getData"+
-k[1]+"!",[k[0]]);if(p===undefined&&this.length)p=e.data(this[0],a);return p===undefined&&k[1]?this.data(k[0]):p}else return this.trigger("setData"+k[1]+"!",[k[0],b]).each(function(){e.data(this,a,b)})},removeData:function(a){return this.each(function(){e.removeData(this,a)})}});e.extend({queue:function(a,b,k){if(a){b=(b||"fx")+"queue";var p=e.data(a,b);if(!k)return p||[];if(!p||e.isArray(k))p=e.data(a,b,e.makeArray(k));else p.push(k);return p}},dequeue:function(a,b){b=b||"fx";var k=e.queue(a,b),p=
-k.shift();if(p==="inprogress")p=k.shift();if(p){b==="fx"&&k.unshift("inprogress");p.call(a,function(){e.dequeue(a,b)})}}});e.fn.extend({queue:function(a,b){if(typeof a!=="string"){b=a;a="fx"}if(b===undefined)return e.queue(this[0],a);return this.each(function(){var k=e.queue(this,a,b);a==="fx"&&k[0]!=="inprogress"&&e.dequeue(this,a)})},dequeue:function(a){return this.each(function(){e.dequeue(this,a)})},delay:function(a,b){a=e.fx?e.fx.speeds[a]||a:a;b=b||"fx";return this.queue(b,function(){var k=
-this;setTimeout(function(){e.dequeue(k,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])}});var fa=/[\n\t]/g,xa=/\s+/,Za=/\r/g,$a=/href|src|style/,ab=/(button|input)/i,bb=/(button|input|object|select|textarea)/i,cb=/^(a|area)$/i,Ka=/radio|checkbox/;e.fn.extend({attr:function(a,b){return l(this,a,b,true,e.attr)},removeAttr:function(a){return this.each(function(){e.attr(this,a,"");this.nodeType===1&&this.removeAttribute(a)})},addClass:function(a){if(e.isFunction(a))return this.each(function(H){var R=
-e(this);R.addClass(a.call(this,H,R.attr("class")))});if(a&&typeof a==="string")for(var b=(a||"").split(xa),k=0,p=this.length;k<p;k++){var o=this[k];if(o.nodeType===1)if(o.className){for(var z=" "+o.className+" ",A=o.className,I=0,E=b.length;I<E;I++)if(z.indexOf(" "+b[I]+" ")<0)A+=" "+b[I];o.className=e.trim(A)}else o.className=a}return this},removeClass:function(a){if(e.isFunction(a))return this.each(function(E){var H=e(this);H.removeClass(a.call(this,E,H.attr("class")))});if(a&&typeof a==="string"||
-a===undefined)for(var b=(a||"").split(xa),k=0,p=this.length;k<p;k++){var o=this[k];if(o.nodeType===1&&o.className)if(a){for(var z=(" "+o.className+" ").replace(fa," "),A=0,I=b.length;A<I;A++)z=z.replace(" "+b[A]+" "," ");o.className=e.trim(z)}else o.className=""}return this},toggleClass:function(a,b){var k=typeof a,p=typeof b==="boolean";if(e.isFunction(a))return this.each(function(o){var z=e(this);z.toggleClass(a.call(this,o,z.attr("class"),b),b)});return this.each(function(){if(k==="string")for(var o,
-z=0,A=e(this),I=b,E=a.split(xa);o=E[z++];){I=p?I:!A.hasClass(o);A[I?"addClass":"removeClass"](o)}else if(k==="undefined"||k==="boolean"){this.className&&e.data(this,"__className__",this.className);this.className=this.className||a===false?"":e.data(this,"__className__")||""}})},hasClass:function(a){a=" "+a+" ";for(var b=0,k=this.length;b<k;b++)if((" "+this[b].className+" ").replace(fa," ").indexOf(a)>-1)return true;return false},val:function(a){if(a===undefined){var b=this[0];if(b){if(e.nodeName(b,
-"option"))return(b.attributes.value||{}).specified?b.value:b.text;if(e.nodeName(b,"select")){var k=b.selectedIndex,p=[],o=b.options;b=b.type==="select-one";if(k<0)return null;var z=b?k:0;for(k=b?k+1:o.length;z<k;z++){var A=o[z];if(A.selected){a=e(A).val();if(b)return a;p.push(a)}}return p}if(Ka.test(b.type)&&!e.support.checkOn)return b.getAttribute("value")===null?"on":b.value;return(b.value||"").replace(Za,"")}}else{var I=e.isFunction(a);return this.each(function(E){var H=e(this),R=a;if(this.nodeType===
-1){if(I)R=a.call(this,E,H.val());if(typeof R==="number")R+="";if(e.isArray(R)&&Ka.test(this.type))this.checked=e.inArray(H.val(),R)>=0;else if(e.nodeName(this,"select")){var W=e.makeArray(R);e("option",this).each(function(){this.selected=e.inArray(e(this).val(),W)>=0});if(!W.length)this.selectedIndex=-1}else this.value=R}})}}});e.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(a,b,k,p){if(!(!a||a.nodeType===3||a.nodeType===8)){if(p&&
-b in e.attrFn)return e(a)[b](k);p=a.nodeType!==1||!e.isXMLDoc(a);var o=k!==undefined;b=p&&e.props[b]||b;if(a.nodeType===1){var z=$a.test(b);if(b in a&&p&&!z){if(o){b==="type"&&ab.test(a.nodeName)&&a.parentNode&&e.error("type property can't be changed");a[b]=k}if(e.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue;if(b==="tabIndex")return(b=a.getAttributeNode("tabIndex"))&&b.specified?b.value:bb.test(a.nodeName)||cb.test(a.nodeName)&&a.href?0:undefined;return a[b]}if(!e.support.style&&
-p&&b==="style"){if(o)a.style.cssText=""+k;return a.style.cssText}o&&a.setAttribute(b,""+k);a=!e.support.hrefNormalized&&p&&z?a.getAttribute(b,2):a.getAttribute(b);return a===null?undefined:a}return e.style(a,b,k)}}});var sa=/\.(.*)$/,db=function(a){return a.replace(/[^\w\s\.\|`]/g,function(b){return"\\"+b})};e.event={add:function(a,b,k,p){if(!(a.nodeType===3||a.nodeType===8)){if(a.setInterval&&a!==window&&!a.frameElement)a=window;var o,z;if(k.handler){o=k;k=o.handler}if(!k.guid)k.guid=e.guid++;if(z=
-e.data(a)){var A=z.events=z.events||{},I=z.handle;if(!I)z.handle=I=function(){return typeof e!=="undefined"&&!e.event.triggered?e.event.handle.apply(I.elem,arguments):undefined};I.elem=a;b=b.split(" ");for(var E,H=0,R;E=b[H++];){z=o?e.extend({},o):{handler:k,data:p};if(E.indexOf(".")>-1){R=E.split(".");E=R.shift();z.namespace=R.slice(0).sort().join(".")}else{R=[];z.namespace=""}z.type=E;z.guid=k.guid;var W=A[E],ba=e.event.special[E]||{};if(!W){W=A[E]=[];if(!ba.setup||ba.setup.call(a,p,R,I)===false)if(a.addEventListener)a.addEventListener(E,
-I,false);else a.attachEvent&&a.attachEvent("on"+E,I)}if(ba.add){ba.add.call(a,z);if(!z.handler.guid)z.handler.guid=k.guid}W.push(z);e.event.global[E]=true}a=null}}},global:{},remove:function(a,b,k,p){if(!(a.nodeType===3||a.nodeType===8)){var o,z=0,A,I,E,H,R,W,ba=e.data(a),ea=ba&&ba.events;if(ba&&ea){if(b&&b.type){k=b.handler;b=b.type}if(!b||typeof b==="string"&&b.charAt(0)==="."){b=b||"";for(o in ea)e.event.remove(a,o+b)}else{for(b=b.split(" ");o=b[z++];){H=o;A=o.indexOf(".")<0;I=[];if(!A){I=o.split(".");
-o=I.shift();E=new RegExp("(^|\\.)"+e.map(I.slice(0).sort(),db).join("\\.(?:.*\\.)?")+"(\\.|$)")}if(R=ea[o])if(k){H=e.event.special[o]||{};for(da=p||0;da<R.length;da++){W=R[da];if(k.guid===W.guid){if(A||E.test(W.namespace)){p==null&&R.splice(da--,1);H.remove&&H.remove.call(a,W)}if(p!=null)break}}if(R.length===0||p!=null&&R.length===1){if(!H.teardown||H.teardown.call(a,I)===false)La(a,o,ba.handle);delete ea[o]}}else for(var da=0;da<R.length;da++){W=R[da];if(A||E.test(W.namespace)){e.event.remove(a,
-H,W.handler,da);R.splice(da--,1)}}}if(e.isEmptyObject(ea)){if(b=ba.handle)b.elem=null;delete ba.events;delete ba.handle;e.isEmptyObject(ba)&&e.removeData(a)}}}}},trigger:function(a,b,k,p){var o=a.type||a;if(!p){a=typeof a==="object"?a[S]?a:e.extend(e.Event(o),a):e.Event(o);if(o.indexOf("!")>=0){a.type=o=o.slice(0,-1);a.exclusive=true}if(!k){a.stopPropagation();e.event.global[o]&&e.each(e.cache,function(){this.events&&this.events[o]&&e.event.trigger(a,b,this.handle.elem)})}if(!k||k.nodeType===3||k.nodeType===
-8)return;a.result=undefined;a.target=k;b=e.makeArray(b);b.unshift(a)}a.currentTarget=k;(p=e.data(k,"handle"))&&p.apply(k,b);p=k.parentNode||k.ownerDocument;try{if(!(k&&k.nodeName&&e.noData[k.nodeName.toLowerCase()]))if(k["on"+o]&&k["on"+o].apply(k,b)===false)a.result=false}catch(z){}if(!a.isPropagationStopped()&&p)e.event.trigger(a,b,p,true);else if(!a.isDefaultPrevented()){p=a.target;var A,I=e.nodeName(p,"a")&&o==="click",E=e.event.special[o]||{};if((!E._default||E._default.call(k,a)===false)&&!I&&
-!(p&&p.nodeName&&e.noData[p.nodeName.toLowerCase()])){try{if(p[o]){if(A=p["on"+o])p["on"+o]=null;e.event.triggered=true;p[o]()}}catch(H){}if(A)p["on"+o]=A;e.event.triggered=false}}},handle:function(a){var b,k,p,o;a=arguments[0]=e.event.fix(a||window.event);a.currentTarget=this;b=a.type.indexOf(".")<0&&!a.exclusive;if(!b){k=a.type.split(".");a.type=k.shift();p=new RegExp("(^|\\.)"+k.slice(0).sort().join("\\.(?:.*\\.)?")+"(\\.|$)")}o=e.data(this,"events");k=o[a.type];if(o&&k){k=k.slice(0);o=0;for(var z=
-k.length;o<z;o++){var A=k[o];if(b||p.test(A.namespace)){a.handler=A.handler;a.data=A.data;a.handleObj=A;A=A.handler.apply(this,arguments);if(A!==undefined){a.result=A;if(A===false){a.preventDefault();a.stopPropagation()}}if(a.isImmediatePropagationStopped())break}}}return a.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),
-fix:function(a){if(a[S])return a;var b=a;a=e.Event(b);for(var k=this.props.length,p;k;){p=this.props[--k];a[p]=b[p]}if(!a.target)a.target=a.srcElement||n;if(a.target.nodeType===3)a.target=a.target.parentNode;if(!a.relatedTarget&&a.fromElement)a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement;if(a.pageX==null&&a.clientX!=null){b=n.documentElement;k=n.body;a.pageX=a.clientX+(b&&b.scrollLeft||k&&k.scrollLeft||0)-(b&&b.clientLeft||k&&k.clientLeft||0);a.pageY=a.clientY+(b&&b.scrollTop||
-k&&k.scrollTop||0)-(b&&b.clientTop||k&&k.clientTop||0)}if(!a.which&&(a.charCode||a.charCode===0?a.charCode:a.keyCode))a.which=a.charCode||a.keyCode;if(!a.metaKey&&a.ctrlKey)a.metaKey=a.ctrlKey;if(!a.which&&a.button!==undefined)a.which=a.button&1?1:a.button&2?3:a.button&4?2:0;return a},guid:1E8,proxy:e.proxy,special:{ready:{setup:e.bindReady,teardown:e.noop},live:{add:function(a){e.event.add(this,a.origType,e.extend({},a,{handler:i}))},remove:function(a){var b=true,k=a.origType.replace(sa,"");e.each(e.data(this,
-"events").live||[],function(){if(k===this.origType.replace(sa,""))return b=false});b&&e.event.remove(this,a.origType,i)}},beforeunload:{setup:function(a,b,k){if(this.setInterval)this.onbeforeunload=k;return false},teardown:function(a,b){if(this.onbeforeunload===b)this.onbeforeunload=null}}}};var La=n.removeEventListener?function(a,b,k){a.removeEventListener(b,k,false)}:function(a,b,k){a.detachEvent("on"+b,k)};e.Event=function(a){if(!this.preventDefault)return new e.Event(a);if(a&&a.type){this.originalEvent=
-a;this.type=a.type}else this.type=a;this.timeStamp=h();this[S]=true};e.Event.prototype={preventDefault:function(){this.isDefaultPrevented=f;var a=this.originalEvent;if(a){a.preventDefault&&a.preventDefault();a.returnValue=false}},stopPropagation:function(){this.isPropagationStopped=f;var a=this.originalEvent;if(a){a.stopPropagation&&a.stopPropagation();a.cancelBubble=true}},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=f;this.stopPropagation()},isDefaultPrevented:d,isPropagationStopped:d,
-isImmediatePropagationStopped:d};var Ma=function(a){var b=a.relatedTarget;try{for(;b&&b!==this;)b=b.parentNode;if(b!==this){a.type=a.data;e.event.handle.apply(this,arguments)}}catch(k){}},Na=function(a){a.type=a.data;e.event.handle.apply(this,arguments)};e.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){e.event.special[a]={setup:function(k){e.event.add(this,b,k&&k.selector?Na:Ma,a)},teardown:function(k){e.event.remove(this,b,k&&k.selector?Na:Ma)}}});if(!e.support.submitBubbles)e.event.special.submit=
-{setup:function(){if(this.nodeName.toLowerCase()!=="form"){e.event.add(this,"click.specialSubmit",function(a){var b=a.target,k=b.type;if((k==="submit"||k==="image")&&e(b).closest("form").length)return m("submit",this,arguments)});e.event.add(this,"keypress.specialSubmit",function(a){var b=a.target,k=b.type;if((k==="text"||k==="password")&&e(b).closest("form").length&&a.keyCode===13)return m("submit",this,arguments)})}else return false},teardown:function(){e.event.remove(this,".specialSubmit")}};if(!e.support.changeBubbles){var ya=
-/textarea|input|select/i,za,Oa=function(a){var b=a.type,k=a.value;if(b==="radio"||b==="checkbox")k=a.checked;else if(b==="select-multiple")k=a.selectedIndex>-1?e.map(a.options,function(p){return p.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")k=a.selectedIndex;return k},Aa=function(a,b){var k=a.target,p,o;if(!(!ya.test(k.nodeName)||k.readOnly)){p=e.data(k,"_change_data");o=Oa(k);if(a.type!=="focusout"||k.type!=="radio")e.data(k,"_change_data",o);if(!(p===undefined||o===p))if(p!=
-null||o){a.type="change";return e.event.trigger(a,b,k)}}};e.event.special.change={filters:{focusout:Aa,click:function(a){var b=a.target,k=b.type;if(k==="radio"||k==="checkbox"||b.nodeName.toLowerCase()==="select")return Aa.call(this,a)},keydown:function(a){var b=a.target,k=b.type;if(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(k==="checkbox"||k==="radio")||k==="select-multiple")return Aa.call(this,a)},beforeactivate:function(a){a=a.target;e.data(a,"_change_data",Oa(a))}},
-setup:function(){if(this.type==="file")return false;for(var a in za)e.event.add(this,a+".specialChange",za[a]);return ya.test(this.nodeName)},teardown:function(){e.event.remove(this,".specialChange");return ya.test(this.nodeName)}};za=e.event.special.change.filters}n.addEventListener&&e.each({focus:"focusin",blur:"focusout"},function(a,b){function k(p){p=e.event.fix(p);p.type=b;return e.event.handle.call(this,p)}e.event.special[b]={setup:function(){this.addEventListener(a,k,true)},teardown:function(){this.removeEventListener(a,
-k,true)}}});e.each(["bind","one"],function(a,b){e.fn[b]=function(k,p,o){if(typeof k==="object"){for(var z in k)this[b](z,p,k[z],o);return this}if(e.isFunction(p)){o=p;p=undefined}var A=b==="one"?e.proxy(o,function(E){e(this).unbind(E,A);return o.apply(this,arguments)}):o;if(k==="unload"&&b!=="one")this.one(k,p,o);else{z=0;for(var I=this.length;z<I;z++)e.event.add(this[z],k,A,p)}return this}});e.fn.extend({unbind:function(a,b){if(typeof a==="object"&&!a.preventDefault)for(var k in a)this.unbind(k,
-a[k]);else{k=0;for(var p=this.length;k<p;k++)e.event.remove(this[k],a,b)}return this},delegate:function(a,b,k,p){return this.live(b,k,p,a)},undelegate:function(a,b,k){return arguments.length===0?this.unbind("live"):this.die(b,null,k,a)},trigger:function(a,b){return this.each(function(){e.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0]){a=e.Event(a);a.preventDefault();a.stopPropagation();e.event.trigger(a,b,this[0]);return a.result}},toggle:function(a){for(var b=arguments,k=1;k<
-b.length;)e.proxy(a,b[k++]);return this.click(e.proxy(a,function(p){var o=(e.data(this,"lastToggle"+a.guid)||0)%k;e.data(this,"lastToggle"+a.guid,o+1);p.preventDefault();return b[o].apply(this,arguments)||false}))},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}});var Pa={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};e.each(["live","die"],function(a,b){e.fn[b]=function(k,p,o,z){var A,I=0,E,H,R=z||this.selector,W=z?this:e(this.context);if(e.isFunction(p)){o=
-p;p=undefined}for(k=(k||"").split(" ");(A=k[I++])!=null;){z=sa.exec(A);E="";if(z){E=z[0];A=A.replace(sa,"")}if(A==="hover")k.push("mouseenter"+E,"mouseleave"+E);else{H=A;if(A==="focus"||A==="blur"){k.push(Pa[A]+E);A+=E}else A=(Pa[A]||A)+E;b==="live"?W.each(function(){e.event.add(this,g(A,R),{data:p,selector:R,handler:o,origType:A,origHandler:o,preType:H})}):W.unbind(g(A,R),o)}}return this}});e.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error".split(" "),
-function(a,b){e.fn[b]=function(k){return k?this.bind(b,k):this.trigger(b)};if(e.attrFn)e.attrFn[b]=true});window.attachEvent&&!window.addEventListener&&window.attachEvent("onunload",function(){for(var a in e.cache)if(e.cache[a].handle)try{e.event.remove(e.cache[a].handle.elem)}catch(b){}});(function(){function a(u){for(var x="",F,G=0;u[G];G++){F=u[G];if(F.nodeType===3||F.nodeType===4)x+=F.nodeValue;else if(F.nodeType!==8)x+=a(F.childNodes)}return x}function b(u,x,F,G,N,M){N=0;for(var X=G.length;N<
-X;N++){var V=G[N];if(V){V=V[u];for(var $=false;V;){if(V.sizcache===F){$=G[V.sizset];break}if(V.nodeType===1&&!M){V.sizcache=F;V.sizset=N}if(V.nodeName.toLowerCase()===x){$=V;break}V=V[u]}G[N]=$}}}function k(u,x,F,G,N,M){N=0;for(var X=G.length;N<X;N++){var V=G[N];if(V){V=V[u];for(var $=false;V;){if(V.sizcache===F){$=G[V.sizset];break}if(V.nodeType===1){if(!M){V.sizcache=F;V.sizset=N}if(typeof x!=="string"){if(V===x){$=true;break}}else if(E.filter(x,[V]).length>0){$=V;break}}V=V[u]}G[N]=$}}}var p=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,
-o=0,z=Object.prototype.toString,A=false,I=true;[0,0].sort(function(){I=false;return 0});var E=function(u,x,F,G){F=F||[];var N=x=x||n;if(x.nodeType!==1&&x.nodeType!==9)return[];if(!u||typeof u!=="string")return F;for(var M=[],X,V,$,ta,oa=true,qa=Y(x),pa=u;(p.exec(""),X=p.exec(pa))!==null;){pa=X[3];M.push(X[1]);if(X[2]){ta=X[3];break}}if(M.length>1&&R.exec(u))if(M.length===2&&H.relative[M[0]])V=Ba(M[0]+M[1],x);else for(V=H.relative[M[0]]?[x]:E(M.shift(),x);M.length;){u=M.shift();if(H.relative[u])u+=
-M.shift();V=Ba(u,V)}else{if(!G&&M.length>1&&x.nodeType===9&&!qa&&H.match.ID.test(M[0])&&!H.match.ID.test(M[M.length-1])){X=E.find(M.shift(),x,qa);x=X.expr?E.filter(X.expr,X.set)[0]:X.set[0]}if(x){X=G?{expr:M.pop(),set:ba(G)}:E.find(M.pop(),M.length===1&&(M[0]==="~"||M[0]==="+")&&x.parentNode?x.parentNode:x,qa);V=X.expr?E.filter(X.expr,X.set):X.set;if(M.length>0)$=ba(V);else oa=false;for(;M.length;){var ia=M.pop();X=ia;if(H.relative[ia])X=M.pop();else ia="";if(X==null)X=x;H.relative[ia]($,X,qa)}}else $=
-[]}$||($=V);$||E.error(ia||u);if(z.call($)==="[object Array]")if(oa)if(x&&x.nodeType===1)for(u=0;$[u]!=null;u++){if($[u]&&($[u]===true||$[u].nodeType===1&&ja(x,$[u])))F.push(V[u])}else for(u=0;$[u]!=null;u++)$[u]&&$[u].nodeType===1&&F.push(V[u]);else F.push.apply(F,$);else ba($,F);if(ta){E(ta,N,F,G);E.uniqueSort(F)}return F};E.uniqueSort=function(u){if(da){A=I;u.sort(da);if(A)for(var x=1;x<u.length;x++)u[x]===u[x-1]&&u.splice(x--,1)}return u};E.matches=function(u,x){return E(u,null,null,x)};E.find=
-function(u,x,F){var G,N;if(!u)return[];for(var M=0,X=H.order.length;M<X;M++){var V=H.order[M];if(N=H.leftMatch[V].exec(u)){var $=N[1];N.splice(1,1);if($.substr($.length-1)!=="\\"){N[1]=(N[1]||"").replace(/\\/g,"");G=H.find[V](N,x,F);if(G!=null){u=u.replace(H.match[V],"");break}}}}G||(G=x.getElementsByTagName("*"));return{set:G,expr:u}};E.filter=function(u,x,F,G){for(var N=u,M=[],X=x,V,$,ta=x&&x[0]&&Y(x[0]);u&&x.length;){for(var oa in H.filter)if((V=H.leftMatch[oa].exec(u))!=null&&V[2]){var qa=H.filter[oa],
-pa,ia;ia=V[1];$=false;V.splice(1,1);if(ia.substr(ia.length-1)!=="\\"){if(X===M)M=[];if(H.preFilter[oa])if(V=H.preFilter[oa](V,X,F,M,G,ta)){if(V===true)continue}else $=pa=true;if(V)for(var ua=0;(ia=X[ua])!=null;ua++)if(ia){pa=qa(ia,V,ua,X);var Qa=G^!!pa;if(F&&pa!=null)if(Qa)$=true;else X[ua]=false;else if(Qa){M.push(ia);$=true}}if(pa!==undefined){F||(X=M);u=u.replace(H.match[oa],"");if(!$)return[];break}}}if(u===N)if($==null)E.error(u);else break;N=u}return X};E.error=function(u){throw"Syntax error, unrecognized expression: "+
-u;};var H=E.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},
-leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(u){return u.getAttribute("href")}},relative:{"+":function(u,x){var F=typeof x==="string",G=F&&!/\W/.test(x);F=F&&!G;if(G)x=x.toLowerCase();G=0;for(var N=u.length,M;G<N;G++)if(M=u[G]){for(;(M=M.previousSibling)&&M.nodeType!==1;);u[G]=F||M&&M.nodeName.toLowerCase()===x?M||false:M===x}F&&E.filter(x,u,true)},">":function(u,x){var F=typeof x==="string";if(F&&!/\W/.test(x)){x=x.toLowerCase();for(var G=0,N=u.length;G<N;G++){var M=
-u[G];if(M){F=M.parentNode;u[G]=F.nodeName.toLowerCase()===x?F:false}}}else{G=0;for(N=u.length;G<N;G++)if(M=u[G])u[G]=F?M.parentNode:M.parentNode===x;F&&E.filter(x,u,true)}},"":function(u,x,F){var G=o++,N=k;if(typeof x==="string"&&!/\W/.test(x)){var M=x=x.toLowerCase();N=b}N("parentNode",x,G,u,M,F)},"~":function(u,x,F){var G=o++,N=k;if(typeof x==="string"&&!/\W/.test(x)){var M=x=x.toLowerCase();N=b}N("previousSibling",x,G,u,M,F)}},find:{ID:function(u,x,F){if(typeof x.getElementById!=="undefined"&&
-!F)return(u=x.getElementById(u[1]))?[u]:[]},NAME:function(u,x){if(typeof x.getElementsByName!=="undefined"){var F=[];x=x.getElementsByName(u[1]);for(var G=0,N=x.length;G<N;G++)x[G].getAttribute("name")===u[1]&&F.push(x[G]);return F.length===0?null:F}},TAG:function(u,x){return x.getElementsByTagName(u[1])}},preFilter:{CLASS:function(u,x,F,G,N,M){u=" "+u[1].replace(/\\/g,"")+" ";if(M)return u;M=0;for(var X;(X=x[M])!=null;M++)if(X)if(N^(X.className&&(" "+X.className+" ").replace(/[\t\n]/g," ").indexOf(u)>=
-0))F||G.push(X);else if(F)x[M]=false;return false},ID:function(u){return u[1].replace(/\\/g,"")},TAG:function(u){return u[1].toLowerCase()},CHILD:function(u){if(u[1]==="nth"){var x=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(u[2]==="even"&&"2n"||u[2]==="odd"&&"2n+1"||!/\D/.test(u[2])&&"0n+"+u[2]||u[2]);u[2]=x[1]+(x[2]||1)-0;u[3]=x[3]-0}u[0]=o++;return u},ATTR:function(u,x,F,G,N,M){x=u[1].replace(/\\/g,"");if(!M&&H.attrMap[x])u[1]=H.attrMap[x];if(u[2]==="~=")u[4]=" "+u[4]+" ";return u},PSEUDO:function(u,x,F,G,
-N){if(u[1]==="not")if((p.exec(u[3])||"").length>1||/^\w/.test(u[3]))u[3]=E(u[3],null,null,x);else{u=E.filter(u[3],x,F,true^N);F||G.push.apply(G,u);return false}else if(H.match.POS.test(u[0])||H.match.CHILD.test(u[0]))return true;return u},POS:function(u){u.unshift(true);return u}},filters:{enabled:function(u){return u.disabled===false&&u.type!=="hidden"},disabled:function(u){return u.disabled===true},checked:function(u){return u.checked===true},selected:function(u){return u.selected===true},parent:function(u){return!!u.firstChild},
-empty:function(u){return!u.firstChild},has:function(u,x,F){return!!E(F[3],u).length},header:function(u){return/h\d/i.test(u.nodeName)},text:function(u){return"text"===u.type},radio:function(u){return"radio"===u.type},checkbox:function(u){return"checkbox"===u.type},file:function(u){return"file"===u.type},password:function(u){return"password"===u.type},submit:function(u){return"submit"===u.type},image:function(u){return"image"===u.type},reset:function(u){return"reset"===u.type},button:function(u){return"button"===
-u.type||u.nodeName.toLowerCase()==="button"},input:function(u){return/input|select|textarea|button/i.test(u.nodeName)}},setFilters:{first:function(u,x){return x===0},last:function(u,x,F,G){return x===G.length-1},even:function(u,x){return x%2===0},odd:function(u,x){return x%2===1},lt:function(u,x,F){return x<F[3]-0},gt:function(u,x,F){return x>F[3]-0},nth:function(u,x,F){return F[3]-0===x},eq:function(u,x,F){return F[3]-0===x}},filter:{PSEUDO:function(u,x,F,G){var N=x[1],M=H.filters[N];if(M)return M(u,
-F,x,G);else if(N==="contains")return(u.textContent||u.innerText||a([u])||"").indexOf(x[3])>=0;else if(N==="not"){x=x[3];F=0;for(G=x.length;F<G;F++)if(x[F]===u)return false;return true}else E.error("Syntax error, unrecognized expression: "+N)},CHILD:function(u,x){var F=x[1],G=u;switch(F){case "only":case "first":for(;G=G.previousSibling;)if(G.nodeType===1)return false;if(F==="first")return true;G=u;case "last":for(;G=G.nextSibling;)if(G.nodeType===1)return false;return true;case "nth":F=x[2];var N=
-x[3];if(F===1&&N===0)return true;x=x[0];var M=u.parentNode;if(M&&(M.sizcache!==x||!u.nodeIndex)){var X=0;for(G=M.firstChild;G;G=G.nextSibling)if(G.nodeType===1)G.nodeIndex=++X;M.sizcache=x}u=u.nodeIndex-N;return F===0?u===0:u%F===0&&u/F>=0}},ID:function(u,x){return u.nodeType===1&&u.getAttribute("id")===x},TAG:function(u,x){return x==="*"&&u.nodeType===1||u.nodeName.toLowerCase()===x},CLASS:function(u,x){return(" "+(u.className||u.getAttribute("class"))+" ").indexOf(x)>-1},ATTR:function(u,x){var F=
-x[1];u=H.attrHandle[F]?H.attrHandle[F](u):u[F]!=null?u[F]:u.getAttribute(F);F=u+"";var G=x[2];x=x[4];return u==null?G==="!=":G==="="?F===x:G==="*="?F.indexOf(x)>=0:G==="~="?(" "+F+" ").indexOf(x)>=0:!x?F&&u!==false:G==="!="?F!==x:G==="^="?F.indexOf(x)===0:G==="$="?F.substr(F.length-x.length)===x:G==="|="?F===x||F.substr(0,x.length+1)===x+"-":false},POS:function(u,x,F,G){var N=H.setFilters[x[2]];if(N)return N(u,F,x,G)}}},R=H.match.POS;for(var W in H.match){H.match[W]=new RegExp(H.match[W].source+/(?![^\[]*\])(?![^\(]*\))/.source);
-H.leftMatch[W]=new RegExp(/(^(?:.|\r|\n)*?)/.source+H.match[W].source.replace(/\\(\d+)/g,function(u,x){return"\\"+(x-0+1)}))}var ba=function(u,x){u=Array.prototype.slice.call(u,0);if(x){x.push.apply(x,u);return x}return u};try{Array.prototype.slice.call(n.documentElement.childNodes,0)}catch(ea){ba=function(u,x){x=x||[];if(z.call(u)==="[object Array]")Array.prototype.push.apply(x,u);else if(typeof u.length==="number")for(var F=0,G=u.length;F<G;F++)x.push(u[F]);else for(F=0;u[F];F++)x.push(u[F]);return x}}var da;
-if(n.documentElement.compareDocumentPosition)da=function(u,x){if(!u.compareDocumentPosition||!x.compareDocumentPosition){if(u==x)A=true;return u.compareDocumentPosition?-1:1}u=u.compareDocumentPosition(x)&4?-1:u===x?0:1;if(u===0)A=true;return u};else if("sourceIndex"in n.documentElement)da=function(u,x){if(!u.sourceIndex||!x.sourceIndex){if(u==x)A=true;return u.sourceIndex?-1:1}u=u.sourceIndex-x.sourceIndex;if(u===0)A=true;return u};else if(n.createRange)da=function(u,x){if(!u.ownerDocument||!x.ownerDocument){if(u==
-x)A=true;return u.ownerDocument?-1:1}var F=u.ownerDocument.createRange(),G=x.ownerDocument.createRange();F.setStart(u,0);F.setEnd(u,0);G.setStart(x,0);G.setEnd(x,0);u=F.compareBoundaryPoints(Range.START_TO_END,G);if(u===0)A=true;return u};(function(){var u=n.createElement("div"),x="script"+(new Date).getTime();u.innerHTML="<a name='"+x+"'/>";var F=n.documentElement;F.insertBefore(u,F.firstChild);if(n.getElementById(x)){H.find.ID=function(G,N,M){if(typeof N.getElementById!=="undefined"&&!M)return(N=
-N.getElementById(G[1]))?N.id===G[1]||typeof N.getAttributeNode!=="undefined"&&N.getAttributeNode("id").nodeValue===G[1]?[N]:undefined:[]};H.filter.ID=function(G,N){var M=typeof G.getAttributeNode!=="undefined"&&G.getAttributeNode("id");return G.nodeType===1&&M&&M.nodeValue===N}}F.removeChild(u);F=u=null})();(function(){var u=n.createElement("div");u.appendChild(n.createComment(""));if(u.getElementsByTagName("*").length>0)H.find.TAG=function(x,F){F=F.getElementsByTagName(x[1]);if(x[1]==="*"){x=[];
-for(var G=0;F[G];G++)F[G].nodeType===1&&x.push(F[G]);F=x}return F};u.innerHTML="<a href='#'></a>";if(u.firstChild&&typeof u.firstChild.getAttribute!=="undefined"&&u.firstChild.getAttribute("href")!=="#")H.attrHandle.href=function(x){return x.getAttribute("href",2)};u=null})();n.querySelectorAll&&function(){var u=E,x=n.createElement("div");x.innerHTML="<p class='TEST'></p>";if(!(x.querySelectorAll&&x.querySelectorAll(".TEST").length===0)){E=function(G,N,M,X){N=N||n;if(!X&&N.nodeType===9&&!Y(N))try{return ba(N.querySelectorAll(G),
-M)}catch(V){}return u(G,N,M,X)};for(var F in u)E[F]=u[F];x=null}}();(function(){var u=n.createElement("div");u.innerHTML="<div class='test e'></div><div class='test'></div>";if(!(!u.getElementsByClassName||u.getElementsByClassName("e").length===0)){u.lastChild.className="e";if(u.getElementsByClassName("e").length!==1){H.order.splice(1,0,"CLASS");H.find.CLASS=function(x,F,G){if(typeof F.getElementsByClassName!=="undefined"&&!G)return F.getElementsByClassName(x[1])};u=null}}})();var ja=n.compareDocumentPosition?
-function(u,x){return!!(u.compareDocumentPosition(x)&16)}:function(u,x){return u!==x&&(u.contains?u.contains(x):true)},Y=function(u){return(u=(u?u.ownerDocument||u:0).documentElement)?u.nodeName!=="HTML":false},Ba=function(u,x){var F=[],G="",N;for(x=x.nodeType?[x]:x;N=H.match.PSEUDO.exec(u);){G+=N[0];u=u.replace(H.match.PSEUDO,"")}u=H.relative[u]?u+"*":u;N=0;for(var M=x.length;N<M;N++)E(u,x[N],F);return E.filter(G,F)};e.find=E;e.expr=E.selectors;e.expr[":"]=e.expr.filters;e.unique=E.uniqueSort;e.text=
-a;e.isXMLDoc=Y;e.contains=ja})();var eb=/Until$/,fb=/^(?:parents|prevUntil|prevAll)/,gb=/,/;O=Array.prototype.slice;var Ra=function(a,b,k){if(e.isFunction(b))return e.grep(a,function(o,z){return!!b.call(o,z,o)===k});else if(b.nodeType)return e.grep(a,function(o){return o===b===k});else if(typeof b==="string"){var p=e.grep(a,function(o){return o.nodeType===1});if(J.test(b))return e.filter(b,p,!k);else b=e.filter(b,p)}return e.grep(a,function(o){return e.inArray(o,b)>=0===k})};e.fn.extend({find:function(a){for(var b=
-this.pushStack("","find",a),k=0,p=0,o=this.length;p<o;p++){k=b.length;e.find(a,this[p],b);if(p>0)for(var z=k;z<b.length;z++)for(var A=0;A<k;A++)if(b[A]===b[z]){b.splice(z--,1);break}}return b},has:function(a){var b=e(a);return this.filter(function(){for(var k=0,p=b.length;k<p;k++)if(e.contains(this,b[k]))return true})},not:function(a){return this.pushStack(Ra(this,a,false),"not",a)},filter:function(a){return this.pushStack(Ra(this,a,true),"filter",a)},is:function(a){return!!a&&e.filter(a,this).length>
-0},closest:function(a,b){if(e.isArray(a)){var k=[],p=this[0],o,z={},A;if(p&&a.length){o=0;for(var I=a.length;o<I;o++){A=a[o];z[A]||(z[A]=e.expr.match.POS.test(A)?e(A,b||this.context):A)}for(;p&&p.ownerDocument&&p!==b;){for(A in z){o=z[A];if(o.jquery?o.index(p)>-1:e(p).is(o)){k.push({selector:A,elem:p});delete z[A]}}p=p.parentNode}}return k}var E=e.expr.match.POS.test(a)?e(a,b||this.context):null;return this.map(function(H,R){for(;R&&R.ownerDocument&&R!==b;){if(E?E.index(R)>-1:e(R).is(a))return R;
-R=R.parentNode}return null})},index:function(a){if(!a||typeof a==="string")return e.inArray(this[0],a?e(a):this.parent().children());return e.inArray(a.jquery?a[0]:a,this)},add:function(a,b){a=typeof a==="string"?e(a,b||this.context):e.makeArray(a);b=e.merge(this.get(),a);return this.pushStack(j(a[0])||j(b[0])?b:e.unique(b))},andSelf:function(){return this.add(this.prevObject)}});e.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return e.dir(a,"parentNode")},
-parentsUntil:function(a,b,k){return e.dir(a,"parentNode",k)},next:function(a){return e.nth(a,2,"nextSibling")},prev:function(a){return e.nth(a,2,"previousSibling")},nextAll:function(a){return e.dir(a,"nextSibling")},prevAll:function(a){return e.dir(a,"previousSibling")},nextUntil:function(a,b,k){return e.dir(a,"nextSibling",k)},prevUntil:function(a,b,k){return e.dir(a,"previousSibling",k)},siblings:function(a){return e.sibling(a.parentNode.firstChild,a)},children:function(a){return e.sibling(a.firstChild)},
-contents:function(a){return e.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:e.makeArray(a.childNodes)}},function(a,b){e.fn[a]=function(k,p){var o=e.map(this,b,k);eb.test(a)||(p=k);if(p&&typeof p==="string")o=e.filter(p,o);o=this.length>1?e.unique(o):o;if((this.length>1||gb.test(p))&&fb.test(a))o=o.reverse();return this.pushStack(o,a,O.call(arguments).join(","))}});e.extend({filter:function(a,b,k){if(k)a=":not("+a+")";return e.find.matches(a,b)},dir:function(a,b,k){var p=[];for(a=
-a[b];a&&a.nodeType!==9&&(k===undefined||a.nodeType!==1||!e(a).is(k));){a.nodeType===1&&p.push(a);a=a[b]}return p},nth:function(a,b,k){b=b||1;for(var p=0;a;a=a[k])if(a.nodeType===1&&++p===b)break;return a},sibling:function(a,b){for(var k=[];a;a=a.nextSibling)a.nodeType===1&&a!==b&&k.push(a);return k}});var Sa=/ jQuery\d+="(?:\d+|null)"/g,va=/^\s+/,Ta=/(<([\w:]+)[^>]*?)\/>/g,hb=/^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,Ua=/<([\w:]+)/,ib=/<tbody/i,jb=/<|&#?\w+;/,Ha=/<script|<object|<embed|<option|<style/i,
-Ia=/checked\s*(?:[^=]|=\s*.checked.)/i,Va=function(a,b,k){return hb.test(k)?a:b+"></"+k+">"},ka={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};ka.optgroup=ka.option;ka.tbody=ka.tfoot=ka.colgroup=ka.caption=ka.thead;ka.th=
-ka.td;if(!e.support.htmlSerialize)ka._default=[1,"div<div>","</div>"];e.fn.extend({text:function(a){if(e.isFunction(a))return this.each(function(b){var k=e(this);k.text(a.call(this,b,k.text()))});if(typeof a!=="object"&&a!==undefined)return this.empty().append((this[0]&&this[0].ownerDocument||n).createTextNode(a));return e.text(this)},wrapAll:function(a){if(e.isFunction(a))return this.each(function(k){e(this).wrapAll(a.call(this,k))});if(this[0]){var b=e(a,this[0].ownerDocument).eq(0).clone(true);
-this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var k=this;k.firstChild&&k.firstChild.nodeType===1;)k=k.firstChild;return k}).append(this)}return this},wrapInner:function(a){if(e.isFunction(a))return this.each(function(b){e(this).wrapInner(a.call(this,b))});return this.each(function(){var b=e(this),k=b.contents();k.length?k.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){e(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){e.nodeName(this,
-"body")||e(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this)});else if(arguments.length){var a=e(arguments[0]);a.push.apply(a,this.toArray());
-return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this.nextSibling)});else if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,e(arguments[0]).toArray());return a}},remove:function(a,b){for(var k=0,p;(p=this[k])!=null;k++)if(!a||e.filter(a,[p]).length){if(!b&&p.nodeType===1){e.cleanData(p.getElementsByTagName("*"));e.cleanData([p])}p.parentNode&&
-p.parentNode.removeChild(p)}return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++)for(b.nodeType===1&&e.cleanData(b.getElementsByTagName("*"));b.firstChild;)b.removeChild(b.firstChild);return this},clone:function(a){var b=this.map(function(){if(!e.support.noCloneEvent&&!e.isXMLDoc(this)){var k=this.outerHTML,p=this.ownerDocument;if(!k){k=p.createElement("div");k.appendChild(this.cloneNode(true));k=k.innerHTML}return e.clean([k.replace(Sa,"").replace(/=([^="'>\s]+\/)>/g,'="$1">').replace(va,
-"")],p)[0]}else return this.cloneNode(true)});if(a===true){q(this,b);q(this.find("*"),b.find("*"))}return b},html:function(a){if(a===undefined)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(Sa,""):null;else if(typeof a==="string"&&!Ha.test(a)&&(e.support.leadingWhitespace||!va.test(a))&&!ka[(Ua.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Ta,Va);try{for(var b=0,k=this.length;b<k;b++)if(this[b].nodeType===1){e.cleanData(this[b].getElementsByTagName("*"));this[b].innerHTML=a}}catch(p){this.empty().append(a)}}else e.isFunction(a)?
-this.each(function(o){var z=e(this),A=z.html();z.empty().append(function(){return a.call(this,o,A)})}):this.empty().append(a);return this},replaceWith:function(a){if(this[0]&&this[0].parentNode){if(e.isFunction(a))return this.each(function(b){var k=e(this),p=k.html();k.replaceWith(a.call(this,b,p))});if(typeof a!=="string")a=e(a).detach();return this.each(function(){var b=this.nextSibling,k=this.parentNode;e(this).remove();b?e(b).before(a):e(k).append(a)})}else return this.pushStack(e(e.isFunction(a)?
-a():a),"replaceWith",a)},detach:function(a){return this.remove(a,true)},domManip:function(a,b,k){function p(W){return e.nodeName(W,"table")?W.getElementsByTagName("tbody")[0]||W.appendChild(W.ownerDocument.createElement("tbody")):W}var o,z,A=a[0],I=[],E;if(!e.support.checkClone&&arguments.length===3&&typeof A==="string"&&Ia.test(A))return this.each(function(){e(this).domManip(a,b,k,true)});if(e.isFunction(A))return this.each(function(W){var ba=e(this);a[0]=A.call(this,W,b?ba.html():undefined);ba.domManip(a,
-b,k)});if(this[0]){o=A&&A.parentNode;o=e.support.parentNode&&o&&o.nodeType===11&&o.childNodes.length===this.length?{fragment:o}:t(a,this,I);E=o.fragment;if(z=E.childNodes.length===1?(E=E.firstChild):E.firstChild){b=b&&e.nodeName(z,"tr");for(var H=0,R=this.length;H<R;H++)k.call(b?p(this[H],z):this[H],H>0||o.cacheable||this.length>1?E.cloneNode(true):E)}I.length&&e.each(I,r)}return this}});e.fragments={};e.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},
-function(a,b){e.fn[a]=function(k){var p=[];k=e(k);var o=this.length===1&&this[0].parentNode;if(o&&o.nodeType===11&&o.childNodes.length===1&&k.length===1){k[b](this[0]);return this}else{o=0;for(var z=k.length;o<z;o++){var A=(o>0?this.clone(true):this).get();e.fn[b].apply(e(k[o]),A);p=p.concat(A)}return this.pushStack(p,a,k.selector)}}});e.extend({clean:function(a,b,k,p){b=b||n;if(typeof b.createElement==="undefined")b=b.ownerDocument||b[0]&&b[0].ownerDocument||n;for(var o=[],z=0,A;(A=a[z])!=null;z++){if(typeof A===
-"number")A+="";if(A){if(typeof A==="string"&&!jb.test(A))A=b.createTextNode(A);else if(typeof A==="string"){A=A.replace(Ta,Va);var I=(Ua.exec(A)||["",""])[1].toLowerCase(),E=ka[I]||ka._default,H=E[0],R=b.createElement("div");for(R.innerHTML=E[1]+A+E[2];H--;)R=R.lastChild;if(!e.support.tbody){H=ib.test(A);I=I==="table"&&!H?R.firstChild&&R.firstChild.childNodes:E[1]==="<table>"&&!H?R.childNodes:[];for(E=I.length-1;E>=0;--E)e.nodeName(I[E],"tbody")&&!I[E].childNodes.length&&I[E].parentNode.removeChild(I[E])}!e.support.leadingWhitespace&&
-va.test(A)&&R.insertBefore(b.createTextNode(va.exec(A)[0]),R.firstChild);A=R.childNodes}if(A.nodeType)o.push(A);else o=e.merge(o,A)}}if(k)for(z=0;o[z];z++)if(p&&e.nodeName(o[z],"script")&&(!o[z].type||o[z].type.toLowerCase()==="text/javascript"))p.push(o[z].parentNode?o[z].parentNode.removeChild(o[z]):o[z]);else{o[z].nodeType===1&&o.splice.apply(o,[z+1,0].concat(e.makeArray(o[z].getElementsByTagName("script"))));k.appendChild(o[z])}return o},cleanData:function(a){for(var b,k,p=e.cache,o=e.event.special,
-z=e.support.deleteExpando,A=0,I;(I=a[A])!=null;A++)if(k=I[e.expando]){b=p[k];if(b.events)for(var E in b.events)o[E]?e.event.remove(I,E):La(I,E,b.handle);if(z)delete I[e.expando];else I.removeAttribute&&I.removeAttribute(e.expando);delete p[k]}}});var kb=/z-?index|font-?weight|opacity|zoom|line-?height/i,Wa=/alpha\([^)]*\)/,Xa=/opacity=([^)]*)/,Ca=/float/i,Da=/-([a-z])/ig,lb=/([A-Z])/g,mb=/^-?\d+(?:px)?$/i,nb=/^-?\d/,ob={position:"absolute",visibility:"hidden",display:"block"},pb=["Left","Right"],
-qb=["Top","Bottom"],rb=n.defaultView&&n.defaultView.getComputedStyle,Ya=e.support.cssFloat?"cssFloat":"styleFloat",Ea=function(a,b){return b.toUpperCase()};e.fn.css=function(a,b){return l(this,a,b,true,function(k,p,o){if(o===undefined)return e.curCSS(k,p);if(typeof o==="number"&&!kb.test(p))o+="px";e.style(k,p,o)})};e.extend({style:function(a,b,k){if(!(!a||a.nodeType===3||a.nodeType===8)){if((b==="width"||b==="height")&&parseFloat(k)<0)k=undefined;var p=a.style||a,o=k!==undefined;if(!e.support.opacity&&
-b==="opacity"){if(o){p.zoom=1;b=parseInt(k,10)+""==="NaN"?"":"alpha(opacity="+k*100+")";a=p.filter||e.curCSS(a,"filter")||"";p.filter=Wa.test(a)?a.replace(Wa,b):b}return p.filter&&p.filter.indexOf("opacity=")>=0?parseFloat(Xa.exec(p.filter)[1])/100+"":""}if(Ca.test(b))b=Ya;b=b.replace(Da,Ea);if(o)p[b]=k;return p[b]}},css:function(a,b,k,p){if(b==="width"||b==="height"){var o,z=b==="width"?pb:qb;k=function(){o=b==="width"?a.offsetWidth:a.offsetHeight;p!=="border"&&e.each(z,function(){p||(o-=parseFloat(e.curCSS(a,
-"padding"+this,true))||0);if(p==="margin")o+=parseFloat(e.curCSS(a,"margin"+this,true))||0;else o-=parseFloat(e.curCSS(a,"border"+this+"Width",true))||0})};a.offsetWidth!==0?k():e.swap(a,ob,k);return Math.max(0,Math.round(o))}return e.curCSS(a,b,k)},curCSS:function(a,b,k){var p,o=a.style;if(!e.support.opacity&&b==="opacity"&&a.currentStyle){p=Xa.test(a.currentStyle.filter||"")?parseFloat(RegExp.$1)/100+"":"";return p===""?"1":p}if(Ca.test(b))b=Ya;if(!k&&o&&o[b])p=o[b];else if(rb){if(Ca.test(b))b=
-"float";b=b.replace(lb,"-$1").toLowerCase();o=a.ownerDocument.defaultView;if(!o)return null;if(a=o.getComputedStyle(a,null))p=a.getPropertyValue(b);if(b==="opacity"&&p==="")p="1"}else if(a.currentStyle){k=b.replace(Da,Ea);p=a.currentStyle[b]||a.currentStyle[k];if(!mb.test(p)&&nb.test(p)){b=o.left;var z=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;o.left=k==="fontSize"?"1em":p||0;p=o.pixelLeft+"px";o.left=b;a.runtimeStyle.left=z}}return p},swap:function(a,b,k){var p={};for(var o in b){p[o]=
-a.style[o];a.style[o]=b[o]}k.call(a);for(o in b)a.style[o]=p[o]}});if(e.expr&&e.expr.filters){e.expr.filters.hidden=function(a){var b=a.offsetWidth,k=a.offsetHeight,p=a.nodeName.toLowerCase()==="tr";return b===0&&k===0&&!p?true:b>0&&k>0&&!p?false:e.curCSS(a,"display")==="none"};e.expr.filters.visible=function(a){return!e.expr.filters.hidden(a)}}var sb=h(),tb=/<script(.|\s)*?\/script>/gi,ub=/select|textarea/i,vb=/color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week/i,
-ra=/=\?(&|$)/,Fa=/\?/,wb=/(\?|&)_=.*?(&|$)/,xb=/^(\w+:)?\/\/([^\/?#]+)/,yb=/%20/g,zb=e.fn.load;e.fn.extend({load:function(a,b,k){if(typeof a!=="string")return zb.call(this,a);else if(!this.length)return this;var p=a.indexOf(" ");if(p>=0){var o=a.slice(p,a.length);a=a.slice(0,p)}p="GET";if(b)if(e.isFunction(b)){k=b;b=null}else if(typeof b==="object"){b=e.param(b,e.ajaxSettings.traditional);p="POST"}var z=this;e.ajax({url:a,type:p,dataType:"html",data:b,complete:function(A,I){if(I==="success"||I===
-"notmodified")z.html(o?e("<div />").append(A.responseText.replace(tb,"")).find(o):A.responseText);k&&z.each(k,[A.responseText,I,A])}});return this},serialize:function(){return e.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?e.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||ub.test(this.nodeName)||vb.test(this.type))}).map(function(a,b){a=e(this).val();return a==null?null:e.isArray(a)?e.map(a,
-function(k){return{name:b.name,value:k}}):{name:b.name,value:a}}).get()}});e.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){e.fn[b]=function(k){return this.bind(b,k)}});e.extend({get:function(a,b,k,p){if(e.isFunction(b)){p=p||k;k=b;b=null}return e.ajax({type:"GET",url:a,data:b,success:k,dataType:p})},getScript:function(a,b){return e.get(a,null,b,"script")},getJSON:function(a,b,k){return e.get(a,b,k,"json")},post:function(a,b,k,p){if(e.isFunction(b)){p=
-p||k;k=b;b={}}return e.ajax({type:"POST",url:a,data:b,success:k,dataType:p})},ajaxSetup:function(a){e.extend(e.ajaxSettings,a)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:window.XMLHttpRequest&&(window.location.protocol!=="file:"||!window.ActiveXObject)?function(){return new window.XMLHttpRequest}:function(){try{return new window.ActiveXObject("Microsoft.XMLHTTP")}catch(a){}},accepts:{xml:"application/xml, text/xml",
-html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},etag:{},ajax:function(a){function b(){o.success&&o.success.call(E,I,A,Y);o.global&&p("ajaxSuccess",[Y,o])}function k(){o.complete&&o.complete.call(E,Y,A);o.global&&p("ajaxComplete",[Y,o]);o.global&&!--e.active&&e.event.trigger("ajaxStop")}function p(N,M){(o.context?e(o.context):e.event).trigger(N,M)}var o=e.extend(true,{},e.ajaxSettings,a),z,
-A,I,E=a&&a.context||o,H=o.type.toUpperCase();if(o.data&&o.processData&&typeof o.data!=="string")o.data=e.param(o.data,o.traditional);if(o.dataType==="jsonp"){if(H==="GET")ra.test(o.url)||(o.url+=(Fa.test(o.url)?"&":"?")+(o.jsonp||"callback")+"=?");else if(!o.data||!ra.test(o.data))o.data=(o.data?o.data+"&":"")+(o.jsonp||"callback")+"=?";o.dataType="json"}if(o.dataType==="json"&&(o.data&&ra.test(o.data)||ra.test(o.url))){z=o.jsonpCallback||"jsonp"+sb++;if(o.data)o.data=(o.data+"").replace(ra,"="+z+
-"$1");o.url=o.url.replace(ra,"="+z+"$1");o.dataType="script";window[z]=window[z]||function(N){I=N;b();k();window[z]=undefined;try{delete window[z]}catch(M){}ba&&ba.removeChild(ea)}}if(o.dataType==="script"&&o.cache===null)o.cache=false;if(o.cache===false&&H==="GET"){var R=h(),W=o.url.replace(wb,"$1_="+R+"$2");o.url=W+(W===o.url?(Fa.test(o.url)?"&":"?")+"_="+R:"")}if(o.data&&H==="GET")o.url+=(Fa.test(o.url)?"&":"?")+o.data;o.global&&!e.active++&&e.event.trigger("ajaxStart");R=(R=xb.exec(o.url))&&(R[1]&&
-R[1]!==location.protocol||R[2]!==location.host);if(o.dataType==="script"&&H==="GET"&&R){var ba=n.getElementsByTagName("head")[0]||n.documentElement,ea=n.createElement("script");ea.src=o.url;if(o.scriptCharset)ea.charset=o.scriptCharset;if(!z){var da=false;ea.onload=ea.onreadystatechange=function(){if(!da&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){da=true;b();k();ea.onload=ea.onreadystatechange=null;ba&&ea.parentNode&&ba.removeChild(ea)}}}ba.insertBefore(ea,ba.firstChild)}else{var ja=
-false,Y=o.xhr();if(Y){o.username?Y.open(H,o.url,o.async,o.username,o.password):Y.open(H,o.url,o.async);try{if(o.data||a&&a.contentType)Y.setRequestHeader("Content-Type",o.contentType);if(o.ifModified){e.lastModified[o.url]&&Y.setRequestHeader("If-Modified-Since",e.lastModified[o.url]);e.etag[o.url]&&Y.setRequestHeader("If-None-Match",e.etag[o.url])}R||Y.setRequestHeader("X-Requested-With","XMLHttpRequest");Y.setRequestHeader("Accept",o.dataType&&o.accepts[o.dataType]?o.accepts[o.dataType]+", */*":
-o.accepts._default)}catch(Ba){}if(o.beforeSend&&o.beforeSend.call(E,Y,o)===false){o.global&&!--e.active&&e.event.trigger("ajaxStop");Y.abort();return false}o.global&&p("ajaxSend",[Y,o]);var u=Y.onreadystatechange=function(N){if(!Y||Y.readyState===0||N==="abort"){ja||k();ja=true;if(Y)Y.onreadystatechange=e.noop}else if(!ja&&Y&&(Y.readyState===4||N==="timeout")){ja=true;Y.onreadystatechange=e.noop;A=N==="timeout"?"timeout":!e.httpSuccess(Y)?"error":o.ifModified&&e.httpNotModified(Y,o.url)?"notmodified":
-"success";var M;if(A==="success")try{I=e.httpData(Y,o.dataType,o)}catch(X){A="parsererror";M=X}if(A==="success"||A==="notmodified")z||b();else e.handleError(o,Y,A,M);k();N==="timeout"&&Y.abort();if(o.async)Y=null}};try{var x=Y.abort;Y.abort=function(){Y&&x.call(Y);u("abort")}}catch(F){}o.async&&o.timeout>0&&setTimeout(function(){Y&&!ja&&u("timeout")},o.timeout);try{Y.send(H==="POST"||H==="PUT"||H==="DELETE"?o.data:null)}catch(G){e.handleError(o,Y,null,G);k()}o.async||u();return Y}}},handleError:function(a,
-b,k,p){if(a.error)a.error.call(a.context||a,b,k,p);if(a.global)(a.context?e(a.context):e.event).trigger("ajaxError",[b,a,p])},active:0,httpSuccess:function(a){try{return!a.status&&location.protocol==="file:"||a.status>=200&&a.status<300||a.status===304||a.status===1223||a.status===0}catch(b){}return false},httpNotModified:function(a,b){var k=a.getResponseHeader("Last-Modified"),p=a.getResponseHeader("Etag");if(k)e.lastModified[b]=k;if(p)e.etag[b]=p;return a.status===304||a.status===0},httpData:function(a,
-b,k){var p=a.getResponseHeader("content-type")||"",o=b==="xml"||!b&&p.indexOf("xml")>=0;a=o?a.responseXML:a.responseText;o&&a.documentElement.nodeName==="parsererror"&&e.error("parsererror");if(k&&k.dataFilter)a=k.dataFilter(a,b);if(typeof a==="string")if(b==="json"||!b&&p.indexOf("json")>=0)a=e.parseJSON(a);else if(b==="script"||!b&&p.indexOf("javascript")>=0)e.globalEval(a);return a},param:function(a,b){function k(A,I){if(e.isArray(I))e.each(I,function(E,H){b||/\[\]$/.test(A)?p(A,H):k(A+"["+(typeof H===
-"object"||e.isArray(H)?E:"")+"]",H)});else!b&&I!=null&&typeof I==="object"?e.each(I,function(E,H){k(A+"["+E+"]",H)}):p(A,I)}function p(A,I){I=e.isFunction(I)?I():I;o[o.length]=encodeURIComponent(A)+"="+encodeURIComponent(I)}var o=[];if(b===undefined)b=e.ajaxSettings.traditional;if(e.isArray(a)||a.jquery)e.each(a,function(){p(this.name,this.value)});else for(var z in a)k(z,a[z]);return o.join("&").replace(yb,"+")}});var Ga={},Ab=/toggle|show|hide/,Bb=/^([+-]=)?([\d+-.]+)(.*)$/,wa,Ja=[["height","marginTop",
-"marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];e.fn.extend({show:function(a,b){if(a||a===0)return this.animate(B("show",3),a,b);else{a=0;for(b=this.length;a<b;a++){var k=e.data(this[a],"olddisplay");this[a].style.display=k||"";if(e.css(this[a],"display")==="none"){k=this[a].nodeName;var p;if(Ga[k])p=Ga[k];else{var o=e("<"+k+" />").appendTo("body");p=o.css("display");if(p==="none")p="block";o.remove();Ga[k]=p}e.data(this[a],
-"olddisplay",p)}}a=0;for(b=this.length;a<b;a++)this[a].style.display=e.data(this[a],"olddisplay")||"";return this}},hide:function(a,b){if(a||a===0)return this.animate(B("hide",3),a,b);else{a=0;for(b=this.length;a<b;a++){var k=e.data(this[a],"olddisplay");!k&&k!=="none"&&e.data(this[a],"olddisplay",e.css(this[a],"display"))}a=0;for(b=this.length;a<b;a++)this[a].style.display="none";return this}},_toggle:e.fn.toggle,toggle:function(a,b){var k=typeof a==="boolean";if(e.isFunction(a)&&e.isFunction(b))this._toggle.apply(this,
-arguments);else a==null||k?this.each(function(){var p=k?a:e(this).is(":hidden");e(this)[p?"show":"hide"]()}):this.animate(B("toggle",3),a,b);return this},fadeTo:function(a,b,k){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,k)},animate:function(a,b,k,p){var o=e.speed(b,k,p);if(e.isEmptyObject(a))return this.each(o.complete);return this[o.queue===false?"each":"queue"](function(){var z=e.extend({},o),A,I=this.nodeType===1&&e(this).is(":hidden"),E=this;for(A in a){var H=
-A.replace(Da,Ea);if(A!==H){a[H]=a[A];delete a[A];A=H}if(a[A]==="hide"&&I||a[A]==="show"&&!I)return z.complete.call(this);if((A==="height"||A==="width")&&this.style){z.display=e.css(this,"display");z.overflow=this.style.overflow}if(e.isArray(a[A])){(z.specialEasing=z.specialEasing||{})[A]=a[A][1];a[A]=a[A][0]}}if(z.overflow!=null)this.style.overflow="hidden";z.curAnim=e.extend({},a);e.each(a,function(R,W){var ba=new e.fx(E,z,R);if(Ab.test(W))ba[W==="toggle"?I?"show":"hide":W](a);else{var ea=Bb.exec(W),
-da=ba.cur(true)||0;if(ea){W=parseFloat(ea[2]);var ja=ea[3]||"px";if(ja!=="px"){E.style[R]=(W||1)+ja;da=(W||1)/ba.cur(true)*da;E.style[R]=da+ja}if(ea[1])W=(ea[1]==="-="?-1:1)*W+da;ba.custom(da,W,ja)}else ba.custom(da,W,"")}});return true})},stop:function(a,b){var k=e.timers;a&&this.queue([]);this.each(function(){for(var p=k.length-1;p>=0;p--)if(k[p].elem===this){b&&k[p](true);k.splice(p,1)}});b||this.dequeue();return this}});e.each({slideDown:B("show",1),slideUp:B("hide",1),slideToggle:B("toggle",
-1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(a,b){e.fn[a]=function(k,p){return this.animate(b,k,p)}});e.extend({speed:function(a,b,k){var p=a&&typeof a==="object"?a:{complete:k||!k&&b||e.isFunction(a)&&a,duration:a,easing:k&&b||b&&!e.isFunction(b)&&b};p.duration=e.fx.off?0:typeof p.duration==="number"?p.duration:e.fx.speeds[p.duration]||e.fx.speeds._default;p.old=p.complete;p.complete=function(){p.queue!==false&&e(this).dequeue();e.isFunction(p.old)&&p.old.call(this)};return p},easing:{linear:function(a,
-b,k,p){return k+p*a},swing:function(a,b,k,p){return(-Math.cos(a*Math.PI)/2+0.5)*p+k}},timers:[],fx:function(a,b,k){this.options=b;this.elem=a;this.prop=k;if(!b.orig)b.orig={}}});e.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this);(e.fx.step[this.prop]||e.fx.step._default)(this);if((this.prop==="height"||this.prop==="width")&&this.elem.style)this.elem.style.display="block"},cur:function(a){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==
-null))return this.elem[this.prop];return(a=parseFloat(e.css(this.elem,this.prop,a)))&&a>-10000?a:parseFloat(e.curCSS(this.elem,this.prop))||0},custom:function(a,b,k){function p(z){return o.step(z)}this.startTime=h();this.start=a;this.end=b;this.unit=k||this.unit||"px";this.now=this.start;this.pos=this.state=0;var o=this;p.elem=this.elem;if(p()&&e.timers.push(p)&&!wa)wa=setInterval(e.fx.tick,13)},show:function(){this.options.orig[this.prop]=e.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop===
-"width"||this.prop==="height"?1:0,this.cur());e(this.elem).show()},hide:function(){this.options.orig[this.prop]=e.style(this.elem,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(a){var b=h(),k=true;if(a||b>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var p in this.options.curAnim)if(this.options.curAnim[p]!==true)k=false;if(k){if(this.options.display!=null){this.elem.style.overflow=
-this.options.overflow;a=e.data(this.elem,"olddisplay");this.elem.style.display=a?a:this.options.display;if(e.css(this.elem,"display")==="none")this.elem.style.display="block"}this.options.hide&&e(this.elem).hide();if(this.options.hide||this.options.show)for(var o in this.options.curAnim)e.style(this.elem,o,this.options.orig[o]);this.options.complete.call(this.elem)}return false}else{o=b-this.startTime;this.state=o/this.options.duration;a=this.options.easing||(e.easing.swing?"swing":"linear");this.pos=
-e.easing[this.options.specialEasing&&this.options.specialEasing[this.prop]||a](this.state,o,0,1,this.options.duration);this.now=this.start+(this.end-this.start)*this.pos;this.update()}return true}};e.extend(e.fx,{tick:function(){for(var a=e.timers,b=0;b<a.length;b++)a[b]()||a.splice(b--,1);a.length||e.fx.stop()},stop:function(){clearInterval(wa);wa=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){e.style(a.elem,"opacity",a.now)},_default:function(a){if(a.elem.style&&a.elem.style[a.prop]!=
-null)a.elem.style[a.prop]=(a.prop==="width"||a.prop==="height"?Math.max(0,a.now):a.now)+a.unit;else a.elem[a.prop]=a.now}}});if(e.expr&&e.expr.filters)e.expr.filters.animated=function(a){return e.grep(e.timers,function(b){return a===b.elem}).length};e.fn.offset="getBoundingClientRect"in n.documentElement?function(a){var b=this[0];if(a)return this.each(function(o){e.offset.setOffset(this,a,o)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return e.offset.bodyOffset(b);var k=b.getBoundingClientRect(),
-p=b.ownerDocument;b=p.body;p=p.documentElement;return{top:k.top+(self.pageYOffset||e.support.boxModel&&p.scrollTop||b.scrollTop)-(p.clientTop||b.clientTop||0),left:k.left+(self.pageXOffset||e.support.boxModel&&p.scrollLeft||b.scrollLeft)-(p.clientLeft||b.clientLeft||0)}}:function(a){var b=this[0];if(a)return this.each(function(R){e.offset.setOffset(this,a,R)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return e.offset.bodyOffset(b);e.offset.initialize();var k=b.offsetParent,p=
-b,o=b.ownerDocument,z,A=o.documentElement,I=o.body;p=(o=o.defaultView)?o.getComputedStyle(b,null):b.currentStyle;for(var E=b.offsetTop,H=b.offsetLeft;(b=b.parentNode)&&b!==I&&b!==A;){if(e.offset.supportsFixedPosition&&p.position==="fixed")break;z=o?o.getComputedStyle(b,null):b.currentStyle;E-=b.scrollTop;H-=b.scrollLeft;if(b===k){E+=b.offsetTop;H+=b.offsetLeft;if(e.offset.doesNotAddBorder&&!(e.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(b.nodeName))){E+=parseFloat(z.borderTopWidth)||
-0;H+=parseFloat(z.borderLeftWidth)||0}p=k;k=b.offsetParent}if(e.offset.subtractsBorderForOverflowNotVisible&&z.overflow!=="visible"){E+=parseFloat(z.borderTopWidth)||0;H+=parseFloat(z.borderLeftWidth)||0}p=z}if(p.position==="relative"||p.position==="static"){E+=I.offsetTop;H+=I.offsetLeft}if(e.offset.supportsFixedPosition&&p.position==="fixed"){E+=Math.max(A.scrollTop,I.scrollTop);H+=Math.max(A.scrollLeft,I.scrollLeft)}return{top:E,left:H}};e.offset={initialize:function(){var a=n.body,b=n.createElement("div"),
-k,p,o,z=parseFloat(e.curCSS(a,"marginTop",true))||0;e.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"});b.innerHTML="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";a.insertBefore(b,a.firstChild);
-k=b.firstChild;p=k.firstChild;o=k.nextSibling.firstChild.firstChild;this.doesNotAddBorder=p.offsetTop!==5;this.doesAddBorderForTableAndCells=o.offsetTop===5;p.style.position="fixed";p.style.top="20px";this.supportsFixedPosition=p.offsetTop===20||p.offsetTop===15;p.style.position=p.style.top="";k.style.overflow="hidden";k.style.position="relative";this.subtractsBorderForOverflowNotVisible=p.offsetTop===-5;this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==z;a.removeChild(b);e.offset.initialize=e.noop},
-bodyOffset:function(a){var b=a.offsetTop,k=a.offsetLeft;e.offset.initialize();if(e.offset.doesNotIncludeMarginInBodyOffset){b+=parseFloat(e.curCSS(a,"marginTop",true))||0;k+=parseFloat(e.curCSS(a,"marginLeft",true))||0}return{top:b,left:k}},setOffset:function(a,b,k){if(/static/.test(e.curCSS(a,"position")))a.style.position="relative";var p=e(a),o=p.offset(),z=parseInt(e.curCSS(a,"top",true),10)||0,A=parseInt(e.curCSS(a,"left",true),10)||0;if(e.isFunction(b))b=b.call(a,k,o);k={top:b.top-o.top+z,left:b.left-
-o.left+A};"using"in b?b.using.call(a,k):p.css(k)}};e.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),k=this.offset(),p=/^body|html$/i.test(b[0].nodeName)?{top:0,left:0}:b.offset();k.top-=parseFloat(e.curCSS(a,"marginTop",true))||0;k.left-=parseFloat(e.curCSS(a,"marginLeft",true))||0;p.top+=parseFloat(e.curCSS(b[0],"borderTopWidth",true))||0;p.left+=parseFloat(e.curCSS(b[0],"borderLeftWidth",true))||0;return{top:k.top-p.top,left:k.left-p.left}},offsetParent:function(){return this.map(function(){for(var a=
-this.offsetParent||n.body;a&&!/^body|html$/i.test(a.nodeName)&&e.css(a,"position")==="static";)a=a.offsetParent;return a})}});e.each(["Left","Top"],function(a,b){var k="scroll"+b;e.fn[k]=function(p){var o=this[0],z;if(!o)return null;if(p!==undefined)return this.each(function(){if(z=C(this))z.scrollTo(!a?p:e(z).scrollLeft(),a?p:e(z).scrollTop());else this[k]=p});else return(z=C(o))?"pageXOffset"in z?z[a?"pageYOffset":"pageXOffset"]:e.support.boxModel&&z.document.documentElement[k]||z.document.body[k]:
-o[k]}});e.each(["Height","Width"],function(a,b){var k=b.toLowerCase();e.fn["inner"+b]=function(){return this[0]?e.css(this[0],k,false,"padding"):null};e.fn["outer"+b]=function(p){return this[0]?e.css(this[0],k,false,p?"margin":"border"):null};e.fn[k]=function(p){var o=this[0];if(!o)return p==null?null:this;if(e.isFunction(p))return this.each(function(z){var A=e(this);A[k](p.call(this,z,A[k]()))});return"scrollTo"in o&&o.document?o.document.compatMode==="CSS1Compat"&&o.document.documentElement["client"+
-b]||o.document.body["client"+b]:o.nodeType===9?Math.max(o.documentElement["client"+b],o.body["scroll"+b],o.documentElement["scroll"+b],o.body["offset"+b],o.documentElement["offset"+b]):p===undefined?e.css(o,k):this.css(k,typeof p==="string"?p:p+"px")}});s.$=s.jQuery=e});bespin.tiki.register("::embedded",{name:"embedded",dependencies:{theme_manager:"0.0.0",text_editor:"0.0.0",appconfig:"0.0.0",edit_session:"0.0.0",screen_theme:"0.0.0"}});bespin.tiki.module("embedded:index",function(){});
-bespin.tiki.register("::settings",{name:"settings",dependencies:{types:"0.0.0"}});
-bespin.tiki.module("settings:commands",function(y,s){y("bespin:plugins");y("environment");var v=y("settings").settings;s.setCommand=function(r,l){var h;if(r.setting)if(r.value===undefined)h="<strong>"+r.setting+"</strong> = "+v.get(r.setting);else{h="Setting: <strong>"+r.setting+"</strong> = "+r.value;v.set(r.setting,r.value)}else{r=v._list();h="";r.sort(function(d,f){return d.key<f.key?-1:d.key==f.key?0:1});r.forEach(function(d){h+='<a class="setting" href="https://wiki.mozilla.org/Labs/Bespin/Settings#'+
-d.key+'" title="View external documentation on setting: '+d.key+'" target="_blank">'+d.key+"</a> = "+d.value+"<br/>"})}l.done(h)};s.unsetCommand=function(r,l){v.resetValue(r.setting);l.done("Reset "+r.setting+" to default: "+v.get(r.setting))}});
-bespin.tiki.module("settings:cookie",function(y,s){var v=y("bespin:util/cookie");s.CookiePersister=function(){};s.CookiePersister.prototype={loadInitialValues:function(r){r._loadDefaultValues().then(function(){var l=v.get("settings");r._loadFromObject(JSON.parse(l))}.bind(this))},persistValue:function(r){try{var l={};r._getSettingNames().forEach(function(f){l[f]=r.get(f)});var h=JSON.stringify(l);v.set("settings",h)}catch(d){console.error("Unable to JSONify the settings! "+d)}}}});
-bespin.tiki.module("settings:index",function(y,s){var v=y("bespin:plugins").catalog,r=y("bespin:console").console,l=y("bespin:promise").Promise,h=y("bespin:promise").group,d=y("types:types");s.addSetting=function(f){y("settings").settings.addSetting(f)};s.getSettings=function(){return v.getExtensions("setting")};s.getTypeSpecFromAssignment=function(f){var m=f.assignments;f="text";if(m){var i=null;m.forEach(function(g){if(g.param.name==="setting")i=g});if(i)if((m=i.value)&&m!=="")if(m=v.getExtensionByKey("setting",
-m))f=m.type}return f};s.MemorySettings=function(){};s.MemorySettings.prototype={_values:{},_deactivated:{},setPersister:function(f){(this._persister=f)&&f.loadInitialValues(this)},get:function(f){return this._values[f]},set:function(f,m){var i=v.getExtensionByKey("setting",f);if(i)if(typeof m=="string"&&i.type=="string")this._values[f]=m;else{var g=false;d.fromString(m,i.type).then(function(j){g=true;this._values[f]=j;v.publish(this,"settingChange",f,j)}.bind(this),function(j){r.error("Error setting",
-f,": ",j)});if(!g){r.warn("About to set string version of ",f,"delaying typed set.");this._values[f]=m}}else{r.warn("Setting not defined: ",f,m);this._deactivated[f]=m}this._persistValue(f,m);return this},addSetting:function(f){if(f.name){!f.defaultValue===undefined&&r.error("Setting.defaultValue == undefined",f);d.isValid(f.defaultValue,f.type).then(function(m){m||r.warn("!Setting.isValid(Setting.defaultValue)",f);this.set(f.name,this._deactivated[f.name]||f.defaultValue)}.bind(this),function(m){r.error("Type error ",
-m," ignoring setting ",f)})}else r.error("Setting.name == undefined. Ignoring.",f)},resetValue:function(f){var m=v.getExtensionByKey("setting",f);m?this.set(f,m.defaultValue):r.log("ignore resetValue on ",f)},resetAll:function(){this._getSettingNames().forEach(function(f){this.resetValue(f)}.bind(this))},_getSettingNames:function(){var f=[];v.getExtensions("setting").forEach(function(m){f.push(m.name)});return f},_list:function(){var f=[];this._getSettingNames().forEach(function(m){f.push({key:m,
-value:this.get(m)})}.bind(this));return f},_persistValue:function(f,m){var i=this._persister;i&&i.persistValue(this,f,m)},_loadInitialValues:function(){var f=this._persister;f?f.loadInitialValues(this):this._loadDefaultValues()},_loadDefaultValues:function(){return this._loadFromObject(this._defaultValues())},_loadFromObject:function(f){var m=[],i=function(B){return function(C){this.set(B,C)}};for(var g in f)if(f.hasOwnProperty(g)){var j=f[g],q=v.getExtensionByKey("setting",g);if(q){j=d.fromString(j,
-q.type);q=i(g);j.then(q);m.push(j)}}var t=new l;h(m).then(function(){t.resolve()});return t},_saveToObject:function(){var f=[],m={};this._getSettingNames().forEach(function(g){var j=this.get(g),q=v.getExtensionByKey("setting",g);if(q){j=d.toString(j,q.type);j.then(function(t){m[g]=t});f.push(j)}}.bind(this));var i=new l;h(f).then(function(){i.resolve(m)});return i},_defaultValues:function(){var f={};v.getExtensions("setting").forEach(function(m){f[m.name]=m.defaultValue});return f}};s.settings=new s.MemorySettings});
-bespin.tiki.register("::appconfig",{name:"appconfig",dependencies:{jquery:"0.0.0",canon:"0.0.0",settings:"0.0.0"}});
-bespin.tiki.module("appconfig:index",function(y,s){var v=y("jquery").$,r=y("settings").settings,l=y("bespin:promise").group,h=y("bespin:promise").Promise,d=y("bespin:console").console,f=y("bespin:util/stacktrace").Trace,m=y("bespin:util/util"),i=true;s.launch=function(q){var t=new h;v("#_bespin_loading").remove();var B;if(i){B=bespin.tiki.require;i=false}else B=(new (bespin.tiki.require("bespin:sandbox").Sandbox)).createRequire({id:"index",ownerPackage:bespin.tiki.loader.anonymousPackage});var C=
-B("bespin:plugins").catalog;q=q||{};s.normalizeConfig(C,q);var e=q.objects;for(var K in e)C.registerObject(K,e[K]);for(var L in q.settings)r.set(L,q.settings[L]);var n=function(){var D=B("environment").env,J=D.editor;if(J){q.lineNumber&&J.setLineNumber(q.lineNumber);if(q.stealFocus)J.focus=true;if(q.readOnly)J.readOnly=q.readOnly;if(q.syntax)J.syntax=q.syntax}if(J=C.getObject("commandLine"))D.commandLine=J;C.publish(this,"appLaunched");t.resolve(D)}.bind(this),w=new h;w.then(function(){e.loginController?
-C.createObject("loginController").then(function(D){D.showLogin().then(function(J){q.objects.session.arguments.push(J);s.launchEditor(C,q).then(n,t.reject.bind(t))})}):s.launchEditor(C,q).then(n,t.reject.bind(t))},function(D){t.reject(D)});C.plugins.theme_manager?bespin.tiki.require.ensurePackage("::theme_manager",function(){var D=B("theme_manager");q.theme.basePlugin&&D.setBasePlugin(q.theme.basePlugin);q.theme.standard&&D.setStandardTheme(q.theme.standard);D.startParsing().then(function(){w.resolve()},
-function(J){w.reject(J)})}):w.resolve();return t};s.normalizeConfig=function(q,t){if(t.objects===undefined)t.objects={};if(t.autoload===undefined)t.autoload=[];if(t.theme===undefined)t.theme={};if(!t.theme.basePlugin&&q.plugins.screen_theme)t.theme.basePlugin="screen_theme";if(!t.initialContent)t.initialContent="";if(!t.settings)t.settings={};if(!t.objects.notifier&&q.plugins.notifier)t.objects.notifier={};if(!t.objects.loginController&&q.plugins.userident)t.objects.loginController={};if(!t.objects.fileHistory&&
-q.plugins.file_history)t.objects.fileHistory={factory:"file_history",arguments:["session"],objects:{"0":"session"}};if(!t.objects.server&&q.plugins.bespin_server){t.objects.server={factory:"bespin_server"};t.objects.filesource={factory:"bespin_filesource",arguments:["server"],objects:{"0":"server"}}}if(!t.objects.files&&q.plugins.filesystem&&t.objects.filesource)t.objects.files={arguments:["filesource"],objects:{"0":"filesource"}};if(!t.objects.editor)t.objects.editor={factory:"text_editor",arguments:[t.initialContent]};
-if(!t.objects.session)t.objects.session={arguments:["editor"],objects:{"0":"editor"}};if(!t.objects.commandLine&&q.plugins.command_line)t.objects.commandLine={};if(t.gui===undefined)t.gui={};q={};for(var B in t.gui){var C=t.gui[B];if(C.component)q[C.component]=true}if(!t.gui.center&&t.objects.editor&&!q.editor)t.gui.center={component:"editor"};if(!t.gui.south&&t.objects.commandLine&&!q.commandLine)t.gui.south={component:"commandLine"}};s.launchEditor=function(q,t){var B=new h;if(t===null){d.error("Cannot start editor without a configuration!");
-B.reject("Cannot start editor without a configuration!");return B}g(q,t).then(function(){j(q,t,B)},function(C){d.error("Error while creating objects");(new f(C)).log();B.reject(C)});return B};var g=function(q,t){var B=[];for(var C in t.objects)B.push(q.createObject(C));return l(B)},j=function(q,t,B){var C=document.createElement("div");C.setAttribute("class","container");var e=document.createElement("div");e.setAttribute("class","center-container");C.appendChild(e);var K=t.element||document.body;m.addClass(K,
-"bespin");K.appendChild(C);for(var L in t.gui){var n=t.gui[L],w=q.getObject(n.component);if(!w){q="Cannot find object "+n.component+" to attach to the Bespin UI";d.error(q);B.reject(q);return}K=w.element;if(!K){q="Component "+n.component+' does not have an "element" attribute to attach to the Bespin UI';d.error(q);B.reject(q);return}v(K).addClass(L);L=="west"||L=="east"||L=="center"?e.appendChild(K):C.appendChild(K);w.elementAppended&&w.elementAppended()}B.resolve()}});
-bespin.tiki.register("::events",{name:"events",dependencies:{traits:"0.0.0"}});bespin.tiki.module("events:index",function(y,s){s.Event=function(){var v=[],r=function(){var l=arguments;v.forEach(function(h){h.func.apply(null,l)})};r.add=function(){arguments.length==1?v.push({ref:arguments[0],func:arguments[0]}):v.push({ref:arguments[0],func:arguments[1]})};r.remove=function(l){v=v.filter(function(h){return l!==h.ref})};r.removeAll=function(){v=[]};return r}});
-bespin.tiki.register("::screen_theme",{name:"screen_theme",dependencies:{theme_manager:"0.0.0"}});bespin.tiki.module("screen_theme:index",function(){});
-(function(){var y=bespin.tiki.require("jquery").$;y(document).ready(function(){bespin.tiki.require("bespin:plugins").catalog.registerMetadata({text_editor:{resourceURL:"resources/text_editor/",description:"Canvas-based text editor component and many common editing commands",dependencies:{completion:"0.0.0",undomanager:"0.0.0",settings:"0.0.0",canon:"0.0.0",rangeutils:"0.0.0",traits:"0.0.0",theme_manager:"0.0.0",keyboard:"0.0.0",edit_session:"0.0.0",syntax_manager:"0.0.0"},testmodules:["tests/controllers/testLayoutmanager",
-"tests/models/testTextstorage","tests/testScratchcanvas","tests/utils/testRect"],provides:[{action:"new",pointer:"views/editor#EditorView",ep:"factory",name:"text_editor"},{pointer:"views/editor#EditorView",ep:"appcomponent",name:"editor_view"},{predicates:{isTextView:true},pointer:"commands/editing#backspace",ep:"command",key:"backspace",name:"backspace"},{predicates:{isTextView:true},pointer:"commands/editing#deleteCommand",ep:"command",key:"delete",name:"delete"},{description:"Delete all lines currently selected",
-key:"ctrl_d",predicates:{isTextView:true},pointer:"commands/editing#deleteLines",ep:"command",name:"deletelines"},{description:"Create a new, empty line below the current one",key:"ctrl_return",predicates:{isTextView:true},pointer:"commands/editing#openLine",ep:"command",name:"openline"},{description:"Join the current line with the following",key:"ctrl_shift_j",predicates:{isTextView:true},pointer:"commands/editing#joinLines",ep:"command",name:"joinline"},{params:[{defaultValue:"",type:"text",name:"text",
-description:"The text to insert"}],pointer:"commands/editing#insertText",ep:"command",name:"insertText"},{predicates:{completing:false,isTextView:true},pointer:"commands/editing#newline",ep:"command",key:"return",name:"newline"},{predicates:{completing:false,isTextView:true},pointer:"commands/editing#tab",ep:"command",key:"tab",name:"tab"},{predicates:{isTextView:true},pointer:"commands/editing#untab",ep:"command",key:"shift_tab",name:"untab"},{predicates:{isTextView:true},ep:"command",name:"move"},
-{description:"Repeat the last search (forward)",pointer:"commands/editor#findNextCommand",ep:"command",key:"ctrl_g",name:"findnext"},{description:"Repeat the last search (backward)",pointer:"commands/editor#findPrevCommand",ep:"command",key:"ctrl_shift_g",name:"findprev"},{predicates:{completing:false,isTextView:true},pointer:"commands/movement#moveDown",ep:"command",key:"down",name:"move down"},{predicates:{isTextView:true},pointer:"commands/movement#moveLeft",ep:"command",key:"left",name:"move left"},
-{predicates:{isTextView:true},pointer:"commands/movement#moveRight",ep:"command",key:"right",name:"move right"},{predicates:{completing:false,isTextView:true},pointer:"commands/movement#moveUp",ep:"command",key:"up",name:"move up"},{predicates:{isTextView:true},ep:"command",name:"select"},{predicates:{isTextView:true},pointer:"commands/movement#selectDown",ep:"command",key:"shift_down",name:"select down"},{predicates:{isTextView:true},pointer:"commands/movement#selectLeft",ep:"command",key:"shift_left",
-name:"select left"},{predicates:{isTextView:true},pointer:"commands/movement#selectRight",ep:"command",key:"shift_right",name:"select right"},{predicates:{isTextView:true},pointer:"commands/movement#selectUp",ep:"command",key:"shift_up",name:"select up"},{predicates:{isTextView:true},pointer:"commands/movement#moveLineEnd",ep:"command",key:["end","ctrl_right"],name:"move lineend"},{predicates:{isTextView:true},pointer:"commands/movement#selectLineEnd",ep:"command",key:["shift_end","ctrl_shift_right"],
-name:"select lineend"},{predicates:{isTextView:true},pointer:"commands/movement#moveDocEnd",ep:"command",key:"ctrl_down",name:"move docend"},{predicates:{isTextView:true},pointer:"commands/movement#selectDocEnd",ep:"command",key:"ctrl_shift_down",name:"select docend"},{predicates:{isTextView:true},pointer:"commands/movement#moveLineStart",ep:"command",key:["home","ctrl_left"],name:"move linestart"},{predicates:{isTextView:true},pointer:"commands/movement#selectLineStart",ep:"command",key:["shift_home",
-"ctrl_shift_left"],name:"select linestart"},{predicates:{isTextView:true},pointer:"commands/movement#moveDocStart",ep:"command",key:"ctrl_up",name:"move docstart"},{predicates:{isTextView:true},pointer:"commands/movement#selectDocStart",ep:"command",key:"ctrl_shift_up",name:"select docstart"},{predicates:{isTextView:true},pointer:"commands/movement#moveNextWord",ep:"command",key:["alt_right"],name:"move nextword"},{predicates:{isTextView:true},pointer:"commands/movement#selectNextWord",ep:"command",
-key:["alt_shift_right"],name:"select nextword"},{predicates:{isTextView:true},pointer:"commands/movement#movePreviousWord",ep:"command",key:["alt_left"],name:"move prevword"},{predicates:{isTextView:true},pointer:"commands/movement#selectPreviousWord",ep:"command",key:["alt_shift_left"],name:"select prevword"},{predicates:{isTextView:true},pointer:"commands/movement#selectAll",ep:"command",key:["ctrl_a","meta_a"],name:"select all"},{predicates:{isTextView:true},ep:"command",name:"scroll"},{predicates:{isTextView:true},
-pointer:"commands/scrolling#scrollDocStart",ep:"command",key:"ctrl_home",name:"scroll start"},{predicates:{isTextView:true},pointer:"commands/scrolling#scrollDocEnd",ep:"command",key:"ctrl_end",name:"scroll end"},{predicates:{isTextView:true},pointer:"commands/scrolling#scrollPageDown",ep:"command",key:"pagedown",name:"scroll down"},{predicates:{isTextView:true},pointer:"commands/scrolling#scrollPageUp",ep:"command",key:"pageup",name:"scroll up"},{pointer:"commands/editor#lcCommand",description:"Change all selected text to lowercase",
-withKey:"CMD SHIFT L",ep:"command",name:"lc"},{pointer:"commands/editor#detabCommand",description:"Convert tabs to spaces.",params:[{defaultValue:null,type:"text",name:"tabsize",description:"Optionally, specify a tab size. (Defaults to setting.)"}],ep:"command",name:"detab"},{pointer:"commands/editor#entabCommand",description:"Convert spaces to tabs.",params:[{defaultValue:null,type:"text",name:"tabsize",description:"Optionally, specify a tab size. (Defaults to setting.)"}],ep:"command",name:"entab"},
-{pointer:"commands/editor#trimCommand",description:"trim trailing or leading whitespace from each line in selection",params:[{defaultValue:"both",type:{data:[{name:"left"},{name:"right"},{name:"both"}],name:"selection"},name:"side",description:"Do we trim from the left, right or both"}],ep:"command",name:"trim"},{pointer:"commands/editor#ucCommand",description:"Change all selected text to uppercase",withKey:"CMD SHIFT U",ep:"command",name:"uc"},{predicates:{isTextView:true},pointer:"controllers/undo#undoManagerCommand",
-ep:"command",key:["ctrl_shift_z"],name:"redo"},{predicates:{isTextView:true},pointer:"controllers/undo#undoManagerCommand",ep:"command",key:["ctrl_z"],name:"undo"},{description:"The distance in characters between each tab",defaultValue:8,type:"number",ep:"setting",name:"tabstop"},{description:"Customize the keymapping",defaultValue:"{}",type:"text",ep:"setting",name:"customKeymapping"},{description:"The keymapping to use",defaultValue:"standard",type:"text",ep:"setting",name:"keymapping"},{description:"The editor font size in pixels",
-defaultValue:14,type:"number",ep:"setting",name:"fontsize"},{description:"The editor font face",defaultValue:"Monaco, Lucida Console, monospace",type:"text",ep:"setting",name:"fontface"},{defaultValue:{color:"#e5c138",paddingLeft:5,backgroundColor:"#4c4a41",paddingRight:10},ep:"themevariable",name:"gutter"},{defaultValue:{color:"#e6e6e6",selectedTextBackgroundColor:"#526da5",backgroundColor:"#2a211c",cursorColor:"#879aff",unfocusedCursorBackgroundColor:"#73171e",unfocusedCursorColor:"#ff0033"},ep:"themevariable",
-name:"editor"},{defaultValue:{comment:"#666666",directive:"#999999",keyword:"#42A8ED",plain:"#e6e6e6",error:"#ff0000",operator:"#88BBFF",identifier:"#D841FF",string:"#039A0A"},ep:"themevariable",name:"highlighter"},{defaultValue:{nibStrokeStyle:"rgb(150, 150, 150)",fullAlpha:1,barFillStyle:"rgb(0, 0, 0)",particalAlpha:0.3,barFillGradientBottomStop:"rgb(44, 44, 44)",backgroundStyle:"#2A211C",thickness:17,padding:5,trackStrokeStyle:"rgb(150, 150, 150)",nibArrowStyle:"rgb(255, 255, 255)",barFillGradientBottomStart:"rgb(22, 22, 22)",
-barFillGradientTopStop:"rgb(40, 40, 40)",barFillGradientTopStart:"rgb(90, 90, 90)",nibStyle:"rgb(100, 100, 100)",trackFillStyle:"rgba(50, 50, 50, 0.8)"},ep:"themevariable",name:"scroller"},{description:"Event: Notify when something within the editor changed.",params:[{required:true,name:"pointer",description:"Function that is called whenever a change happened."}],ep:"extensionpoint",name:"editorChange"}],type:"plugins/supported",name:"text_editor"},less:{resourceURL:"resources/less/",description:"Leaner CSS",
-contributors:[],author:"Alexis Sellier <self@cloudhead.net>",url:"http://lesscss.org",version:"1.0.11",dependencies:{},testmodules:[],provides:[],keywords:["css","parser","lesscss","browser"],type:"plugins/thirdparty",name:"less"},theme_manager_base:{resourceURL:"resources/theme_manager_base/",name:"theme_manager_base",share:true,environments:{main:true},dependencies:{},testmodules:[],provides:[{description:"(Less)files holding the CSS style information for the UI.",params:[{required:true,name:"url",
-description:"Name of the ThemeStylesFile - can also be an array of files."}],ep:"extensionpoint",name:"themestyles"},{description:"Event: Notify when the theme(styles) changed.",params:[{required:true,name:"pointer",description:"Function that is called whenever the theme is changed."}],ep:"extensionpoint",name:"themeChange"},{indexOn:"name",description:"A theme is a way change the look of the application.",params:[{required:false,name:"url",description:"Name of a ThemeStylesFile that holds theme specific CSS rules - can also be an array of files."},
-{required:true,name:"pointer",description:"Function that returns the ThemeData"}],ep:"extensionpoint",name:"theme"}],type:"plugins/supported",description:"Defines extension points required for theming"},canon:{resourceURL:"resources/canon/",name:"canon",environments:{main:true,worker:false},dependencies:{environment:"0.0.0",events:"0.0.0",settings:"0.0.0"},testmodules:[],provides:[{indexOn:"name",description:"A command is a bit of functionality with optional typed arguments which can do something small like moving the cursor around the screen, or large like cloning a project from VCS.",
-ep:"extensionpoint",name:"command"},{description:"An extension point to be called whenever a new command begins output.",ep:"extensionpoint",name:"addedRequestOutput"},{description:"A dimensionsChanged is a way to be notified of changes to the dimension of Bespin",ep:"extensionpoint",name:"dimensionsChanged"},{description:"How many typed commands do we recall for reference?",defaultValue:50,type:"number",ep:"setting",name:"historyLength"},{action:"create",pointer:"history#InMemoryHistory",ep:"factory",
-name:"history"}],type:"plugins/supported",description:"Manages commands"},traits:{resourceURL:"resources/traits/",description:"Traits library, traitsjs.org",dependencies:{},testmodules:[],provides:[],type:"plugins/thirdparty",name:"traits"},keyboard:{resourceURL:"resources/keyboard/",description:"Keyboard shortcuts",dependencies:{canon:"0.0",settings:"0.0"},testmodules:["tests/testKeyboard"],provides:[{description:"A keymapping defines how keystrokes are interpreted.",params:[{required:true,name:"states",
-description:"Holds the states and all the informations about the keymapping. See docs: pluginguide/keymapping"}],ep:"extensionpoint",name:"keymapping"}],type:"plugins/supported",name:"keyboard"},worker_manager:{resourceURL:"resources/worker_manager/",description:"Manages a web worker on the browser side",dependencies:{canon:"0.0.0",events:"0.0.0",underscore:"0.0.0"},testmodules:[],provides:[{description:"Low-level web worker control (for plugin development)",ep:"command",name:"worker"},{description:"Restarts all web workers (for plugin development)",
-pointer:"#workerRestartCommand",ep:"command",name:"worker restart"}],type:"plugins/supported",name:"worker_manager"},edit_session:{resourceURL:"resources/edit_session/",description:"Ties together the files being edited with the views on screen",dependencies:{events:"0.0.0"},testmodules:["tests/testSession"],provides:[{action:"call",pointer:"#createSession",ep:"factory",name:"session"}],type:"plugins/supported",name:"edit_session"},syntax_manager:{resourceURL:"resources/syntax_manager/",name:"syntax_manager",
-environments:{main:true,worker:false},dependencies:{worker_manager:"0.0.0",events:"0.0.0",underscore:"0.0.0",syntax_directory:"0.0.0"},testmodules:[],provides:[],type:"plugins/supported",description:"Provides syntax highlighting services for the editor"},completion:{resourceURL:"resources/completion/",description:"Code completion support",dependencies:{jquery:"0.0.0",ctags:"0.0.0",rangeutils:"0.0.0",canon:"0.0.0",underscore:"0.0.0"},testmodules:[],provides:[{indexOn:"name",description:"Code completion support for specific languages",
-ep:"extensionpoint",name:"completion"},{description:"Accept the chosen completion",key:["return","tab"],predicates:{completing:true},pointer:"controller#completeCommand",ep:"command",name:"complete"},{description:"Abandon the completion",key:"escape",predicates:{completing:true},pointer:"controller#completeCancelCommand",ep:"command",name:"complete cancel"},{description:"Choose the completion below",key:"down",predicates:{completing:true},pointer:"controller#completeDownCommand",ep:"command",name:"complete down"},
-{description:"Choose the completion above",key:"up",predicates:{completing:true},pointer:"controller#completeUpCommand",ep:"command",name:"complete up"}],type:"plugins/supported",name:"completion"},environment:{testmodules:[],dependencies:{settings:"0.0.0"},resourceURL:"resources/environment/",name:"environment",type:"plugins/supported"},undomanager:{resourceURL:"resources/undomanager/",description:"Manages undoable events",testmodules:["tests/testUndomanager"],provides:[{pointer:"#undoManagerCommand",
-ep:"command",key:["ctrl_shift_z"],name:"redo"},{pointer:"#undoManagerCommand",ep:"command",key:["ctrl_z"],name:"undo"}],type:"plugins/supported",name:"undomanager"},rangeutils:{testmodules:["tests/test"],type:"plugins/supported",resourceURL:"resources/rangeutils/",description:"Utility functions for dealing with ranges of text",name:"rangeutils"},stylesheet:{resourceURL:"resources/stylesheet/",name:"stylesheet",environments:{worker:true},dependencies:{standard_syntax:"0.0.0"},testmodules:[],provides:[{pointer:"#CSSSyntax",
-ep:"syntax",fileexts:["css","less"],name:"css"}],type:"plugins/supported",description:"CSS syntax highlighter"},html:{resourceURL:"resources/html/",name:"html",environments:{worker:true},dependencies:{standard_syntax:"0.0.0"},testmodules:[],provides:[{pointer:"#HTMLSyntax",ep:"syntax",fileexts:["htm","html"],name:"html"}],type:"plugins/supported",description:"HTML syntax highlighter"},js_syntax:{resourceURL:"resources/js_syntax/",name:"js_syntax",environments:{worker:true},dependencies:{standard_syntax:"0.0.0"},
-testmodules:[],provides:[{pointer:"#JSSyntax",ep:"syntax",fileexts:["js","json"],name:"js"}],type:"plugins/supported",description:"JavaScript syntax highlighter"},ctags:{resourceURL:"resources/ctags/",description:"Reads and writes tag files",dependencies:{traits:"0.0.0",underscore:"0.0.0"},testmodules:[],type:"plugins/supported",name:"ctags"},events:{resourceURL:"resources/events/",description:"Dead simple event implementation",dependencies:{traits:"0.0"},testmodules:["tests/test"],provides:[],type:"plugins/supported",
-name:"events"},theme_manager:{resourceURL:"resources/theme_manager/",name:"theme_manager",share:true,environments:{main:true,worker:false},dependencies:{theme_manager_base:"0.0.0",settings:"0.0.0",events:"0.0.0",less:"0.0.0"},testmodules:[],provides:[{unregister:"themestyles#unregisterThemeStyles",register:"themestyles#registerThemeStyles",ep:"extensionhandler",name:"themestyles"},{unregister:"index#unregisterTheme",register:"index#registerTheme",ep:"extensionhandler",name:"theme"},{defaultValue:"standard",
-description:"The theme plugin's name to use. If set to 'standard' no theme will be used",type:"text",ep:"setting",name:"theme"},{pointer:"#appLaunched",ep:"appLaunched"}],type:"plugins/supported",description:"Handles colors in Bespin"},standard_syntax:{resourceURL:"resources/standard_syntax/",description:"Easy-to-use basis for syntax engines",environments:{worker:true},dependencies:{syntax_worker:"0.0.0",syntax_directory:"0.0.0",underscore:"0.0.0"},testmodules:[],type:"plugins/supported",name:"standard_syntax"},
-types:{resourceURL:"resources/types/",description:"Defines parameter types for commands",testmodules:["tests/testBasic","tests/testTypes"],provides:[{indexOn:"name",description:"Commands can accept various arguments that the user enters or that are automatically supplied by the environment. Those arguments have types that define how they are supplied or completed. The pointer points to an object with methods convert(str value) and getDefault(). Both functions have `this` set to the command's `takes` parameter. If getDefault is not defined, the default on the command's `takes` is used, if there is one. The object can have a noInput property that is set to true to reflect that this type is provided directly by the system. getDefault must be defined in that case.",
-ep:"extensionpoint",name:"type"},{description:"Text that the user needs to enter.",pointer:"basic#text",ep:"type",name:"text"},{description:"A JavaScript number",pointer:"basic#number",ep:"type",name:"number"},{description:"A true/false value",pointer:"basic#bool",ep:"type",name:"boolean"},{description:"An object that converts via JavaScript",pointer:"basic#object",ep:"type",name:"object"},{description:"A string that is constrained to be one of a number of pre-defined values",pointer:"basic#selection",
-ep:"type",name:"selection"},{description:"A type which we don't understand from the outset, but which we hope context can help us with",ep:"type",name:"deferred"}],type:"plugins/supported",name:"types"},jquery:{testmodules:[],resourceURL:"resources/jquery/",name:"jquery",type:"plugins/thirdparty"},embedded:{testmodules:[],dependencies:{theme_manager:"0.0.0",text_editor:"0.0.0",appconfig:"0.0.0",edit_session:"0.0.0",screen_theme:"0.0.0"},resourceURL:"resources/embedded/",name:"embedded",type:"plugins/supported"},
-settings:{resourceURL:"resources/settings/",description:"Infrastructure and commands for managing user preferences",share:true,dependencies:{types:"0.0"},testmodules:[],provides:[{description:"Storage for the customizable Bespin settings",pointer:"index#settings",ep:"appcomponent",name:"settings"},{indexOn:"name",description:"A setting is something that the application offers as a way to customize how it works",register:"index#addSetting",ep:"extensionpoint",name:"setting"},{description:"A settingChange is a way to be notified of changes to a setting",
-ep:"extensionpoint",name:"settingChange"},{pointer:"commands#setCommand",description:"define and show settings",params:[{defaultValue:null,type:{pointer:"settings:index#getSettings",name:"selection"},name:"setting",description:"The name of the setting to display or alter"},{defaultValue:null,type:{pointer:"settings:index#getTypeSpecFromAssignment",name:"deferred"},name:"value",description:"The new value for the chosen setting"}],ep:"command",name:"set"},{pointer:"commands#unsetCommand",description:"unset a setting entirely",
-params:[{type:{pointer:"settings:index#getSettings",name:"selection"},name:"setting",description:"The name of the setting to return to defaults"}],ep:"command",name:"unset"}],type:"plugins/supported",name:"settings"},appconfig:{resourceURL:"resources/appconfig/",description:"Instantiates components and displays the GUI based on configuration.",dependencies:{jquery:"0.0.0",canon:"0.0.0",settings:"0.0.0"},testmodules:[],provides:[{description:"Event: Fired when the app is completely launched.",ep:"extensionpoint",
-name:"appLaunched"}],type:"plugins/supported",name:"appconfig"},syntax_worker:{resourceURL:"resources/syntax_worker/",description:"Coordinates multiple syntax engines",environments:{worker:true},dependencies:{syntax_directory:"0.0.0",underscore:"0.0.0"},testmodules:[],type:"plugins/supported",name:"syntax_worker"},screen_theme:{resourceURL:"resources/screen_theme/",description:"Bespins standard theme basePlugin",dependencies:{theme_manager:"0.0.0"},testmodules:[],provides:[{url:["theme.less"],ep:"themestyles"},
-{defaultValue:"@global_font",ep:"themevariable",name:"container_font"},{defaultValue:"@global_font_size",ep:"themevariable",name:"container_font_size"},{defaultValue:"@global_container_background",ep:"themevariable",name:"container_bg"},{defaultValue:"@global_color",ep:"themevariable",name:"container_color"},{defaultValue:"@global_line_height",ep:"themevariable",name:"container_line_height"},{defaultValue:"@global_pane_background",ep:"themevariable",name:"pane_bg"},{defaultValue:"@global_pane_border_radius",
-ep:"themevariable",name:"pane_border_radius"},{defaultValue:"@global_form_font",ep:"themevariable",name:"form_font"},{defaultValue:"@global_form_font_size",ep:"themevariable",name:"form_font_size"},{defaultValue:"@global_form_line_height",ep:"themevariable",name:"form_line_height"},{defaultValue:"@global_form_color",ep:"themevariable",name:"form_color"},{defaultValue:"@global_form_text_shadow",ep:"themevariable",name:"form_text_shadow"},{defaultValue:"@global_pane_link_color",ep:"themevariable",name:"pane_a_color"},
-{defaultValue:"@global_font",ep:"themevariable",name:"pane_font"},{defaultValue:"@global_font_size",ep:"themevariable",name:"pane_font_size"},{defaultValue:"@global_pane_text_shadow",ep:"themevariable",name:"pane_text_shadow"},{defaultValue:"@global_pane_h1_font",ep:"themevariable",name:"pane_h1_font"},{defaultValue:"@global_pane_h1_font_size",ep:"themevariable",name:"pane_h1_font_size"},{defaultValue:"@global_pane_h1_color",ep:"themevariable",name:"pane_h1_color"},{defaultValue:"@global_font_size * 1.8",
-ep:"themevariable",name:"pane_line_height"},{defaultValue:"@global_pane_color",ep:"themevariable",name:"pane_color"},{defaultValue:"@global_text_shadow",ep:"themevariable",name:"pane_text_shadow"},{defaultValue:"@global_font",ep:"themevariable",name:"button_font"},{defaultValue:"@global_font_size",ep:"themevariable",name:"button_font_size"},{defaultValue:"@global_button_color",ep:"themevariable",name:"button_color"},{defaultValue:"@global_button_background",ep:"themevariable",name:"button_bg"},{defaultValue:"@button_bg - #063A27",
-ep:"themevariable",name:"button_bg2"},{defaultValue:"@button_bg - #194A5E",ep:"themevariable",name:"button_border"},{defaultValue:"@global_control_background",ep:"themevariable",name:"control_bg"},{defaultValue:"@global_control_color",ep:"themevariable",name:"control_color"},{defaultValue:"@global_control_border",ep:"themevariable",name:"control_border"},{defaultValue:"@global_control_border_radius",ep:"themevariable",name:"control_border_radius"},{defaultValue:"@global_control_active_background",
-ep:"themevariable",name:"control_active_bg"},{defaultValue:"@global_control_active_border",ep:"themevariable",name:"control_active_border"},{defaultValue:"@global_control_active_color",ep:"themevariable",name:"control_active_color"},{defaultValue:"@global_control_active_inset_color",ep:"themevariable",name:"control_active_inset_color"}],type:"plugins/supported",name:"screen_theme"}})})})();
-(function(){var y=bespin.tiki.require("jquery").$,s=function(v,r,l){v=v.style[l]||document.defaultView.getComputedStyle(v,"").getPropertyValue(l);if(!v||v=="auto"||v=="intrinsic")v=r.style[l];return v};bespin.useBespin=function(v,r){var l=bespin.tiki.require("bespin:util/util"),h={},d=h.settings;r=r||{};for(var f in r)h[f]=r[f];r=h.settings;if(d!==undefined)for(f in d)if(r[f]===undefined)h.settings[f]=d[f];var m=null,i=new (bespin.tiki.require("bespin:promise").Promise);bespin.tiki.require.ensurePackage("::appconfig",
-function(){var g=bespin.tiki.require("appconfig");if(l.isString(v))v=document.getElementById(v);if(l.none(h.initialContent))h.initialContent=v.value||v.innerHTML;v.innerHTML="";if(v.type=="textarea"){var j=v.parentNode,q=document.createElement("div"),t=function(){var C="position:relative;";["margin-top","margin-left","margin-right","margin-bottom"].forEach(function(L){C+=L+":"+s(v,q,L)+";"});var e=s(v,q,"width"),K=s(v,q,"height");C+="height:"+K+";width:"+e+";";C+="display:inline-block;";q.setAttribute("style",
-C)};window.addEventListener("resize",t,false);t();for(v.nextSibling?j.insertBefore(q,v.nextSibling):j.appendChild(q);j!==document;){if(j.tagName.toUpperCase()==="FORM"){var B=j.onsubmit;j.onsubmit=function(C){v.value=m.editor.value;v.innerHTML=m.editor.value;B&&B.call(this,C)};break}j=j.parentNode}v.style.display="none";h.element=q;if(!l.none(v.getAttribute("readonly")))h.readOnly=true}else h.element=v;g.launch(h).then(function(C){m=C;i.resolve(C)})});return i};y(document).ready(function(){for(var v=
-[],r=document.querySelectorAll(".bespin"),l=0;l<r.length;l++){var h=r[l],d=h.getAttribute("data-bespinoptions")||"{}";d=bespin.useBespin(h,JSON.parse(d));d.then(function(f){h.bespin=f},function(f){throw new Error("Launch failed: "+f);});v.push(d)}if(window.onBespinLoad){r=bespin.tiki.require("bespin:promise").group;r(v).then(function(){window.onBespinLoad()},function(){throw new Error("At least one Bespin failed to launch!");})}})})();
deleted file mode 100644
--- a/mail/test/resources/mozmill/mozmill/extension/content/editor/bespin/BespinWorker.js
+++ /dev/null
@@ -1,31 +0,0 @@
-bespin.tiki.register("::syntax_worker",{name:"syntax_worker",dependencies:{syntax_directory:"0.0.0",underscore:"0.0.0"}});
-bespin.tiki.module("syntax_worker:index",function(b,f){var c=b("bespin:promise"),d=b("underscore")._;b("bespin:console");var a=b("syntax_directory").syntaxDirectory;f.syntaxWorker={engines:{},annotate:function(e,m){function n(i){return i.split(":")}function o(){p.push(d(g).invoke("join",":").join(" "))}var l=this.engines,p=[],j=[],q=[],g=d(e.split(" ")).map(n);d(m).each(function(i){o();for(var r=[],t={},k=0;k<i.length;){for(var s;;){s=d(g).last();if(s.length<3)break;var h=s[2];if(i.substring(k,k+
-h.length)!==h)break;g.pop()}h=l[s[0]].get(s,i,k);if(h==null)k={state:"plain",tag:"plain",start:k,end:i.length};else{g[g.length-1]=h.state;h.hasOwnProperty("newContext")&&g.push(h.newContext);k=h.token;h=h.symbol;if(h!=null)t["-"+h[0]]=h[1]}r.push(k);k=k.end}j.push(r);q.push(t)});o();return{states:p,attrs:j,symbols:q}},loadSyntax:function(e){var m=new c.Promise,n=this.engines;if(n.hasOwnProperty(e)){m.resolve();return m}var o=a.get(e);if(o==null)throw new Error('No syntax engine installed for syntax "'+
-e+'".');o.extension.load().then(function(l){n[e]=l;l=l.subsyntaxes;l==null?m.resolve():c.group(d(l).map(this.loadSyntax,this)).then(d(m.resolve).bind(m))}.bind(this));return m}}});bespin.tiki.register("::stylesheet",{name:"stylesheet",dependencies:{standard_syntax:"0.0.0"}});
-bespin.tiki.module("stylesheet:index",function(b,f){b("bespin:promise");b=b("standard_syntax").StandardSyntax;var c={regex:/^\/\/.*/,tag:"comment"},d=function(a){return[{regex:/^[^*\/]+/,tag:"comment"},{regex:/^\*\//,tag:"comment",then:a},{regex:/^[*\/]/,tag:"comment"}]};c={start:[{regex:/^([a-zA-Z-\s]*)(?:\:)/,tag:"identifier",then:"style"},{regex:/^([\w]+)(?![a-zA-Z0-9_:])([,|{]*?)(?!;)(?!(;|%))/,tag:"keyword",then:"header"},{regex:/^#([a-zA-Z]*)(?=.*{*?)/,tag:"keyword",then:"header"},{regex:/^\.([a-zA-Z]*)(?=.*{*?)/,
-tag:"keyword",then:"header"},c,{regex:/^\/\*/,tag:"comment",then:"comment"},{regex:/^./,tag:"plain"}],header:[{regex:/^[^{|\/\/|\/\*]*/,tag:"keyword",then:"start"},c,{regex:/^\/\*/,tag:"comment",then:"comment_header"}],style:[{regex:/^[^;|}|\/\/|\/\*]+/,tag:"plain"},{regex:/^;|}/,tag:"plain",then:"start"},c,{regex:/^\/\*/,tag:"comment",then:"comment_style"}],comment:d("start"),comment_header:d("header"),comment_style:d("style")};f.CSSSyntax=new b(c)});bespin.tiki.register("::html",{name:"html",dependencies:{standard_syntax:"0.0.0"}});
-bespin.tiki.module("html:index",function(b,f){b=b("standard_syntax").StandardSyntax;var c={},d=function(a,e){c[a+"_beforeAttrName"]=[{regex:/^\s+/,tag:"plain"},{regex:/^\//,tag:"operator",then:a+"_selfClosingStartTag"},{regex:/^>/,tag:"operator",then:e},{regex:/^./,tag:"keyword",then:a+"_attrName"}];c[a+"_attrName"]=[{regex:/^\s+/,tag:"plain",then:a+"_afterAttrName"},{regex:/^\//,tag:"operator",then:a+"_selfClosingStartTag"},{regex:/^=/,tag:"operator",then:a+"_beforeAttrValue"},{regex:/^>/,tag:"operator",
-then:e},{regex:/^["'<]+/,tag:"error"},{regex:/^[^ \t\n\/=>"'<]+/,tag:"keyword"}];c[a+"_afterAttrName"]=[{regex:/^\s+/,tag:"plain"},{regex:/^\//,tag:"operator",then:a+"_selfClosingStartTag"},{regex:/^=/,tag:"operator",then:a+"_beforeAttrValue"},{regex:/^>/,tag:"operator",then:e},{regex:/^./,tag:"keyword",then:a+"_attrName"}];c[a+"_beforeAttrValue"]=[{regex:/^\s+/,tag:"plain"},{regex:/^"/,tag:"string",then:a+"_attrValueQQ"},{regex:/^(?=&)/,tag:"plain",then:a+"_attrValueU"},{regex:/^'/,tag:"string",
-then:a+"_attrValueQ"},{regex:/^>/,tag:"error",then:e},{regex:/^./,tag:"string",then:a+"_attrValueU"}];c[a+"_attrValueQQ"]=[{regex:/^"/,tag:"string",then:a+"_afterAttrValueQ"},{regex:/^[^"]+/,tag:"string"}];c[a+"_attrValueQ"]=[{regex:/^'/,tag:"string",then:a+"_afterAttrValueQ"},{regex:/^[^']+/,tag:"string"}];c[a+"_attrValueU"]=[{regex:/^\s/,tag:"string",then:a+"_beforeAttrName"},{regex:/^>/,tag:"operator",then:e},{regex:/[^ \t\n>]+/,tag:"string"}];c[a+"_afterAttrValueQ"]=[{regex:/^\s/,tag:"plain",
-then:a+"_beforeAttrName"},{regex:/^\//,tag:"operator",then:a+"_selfClosingStartTag"},{regex:/^>/,tag:"operator",then:e},{regex:/^(?=.)/,tag:"operator",then:a+"_beforeAttrName"}];c[a+"_selfClosingStartTag"]=[{regex:/^>/,tag:"operator",then:"start"},{regex:/^./,tag:"error",then:a+"_beforeAttrName"}]};c={start:[{regex:/^[^<]+/,tag:"plain"},{regex:/^<!--/,tag:"comment",then:"commentStart"},{regex:/^<!/,tag:"directive",then:"markupDeclarationOpen"},{regex:/^<\?/,tag:"comment",then:"bogusComment"},{regex:/^</,
-tag:"operator",then:"tagOpen"}],tagOpen:[{regex:/^\//,tag:"operator",then:"endTagOpen"},{regex:/^script/i,tag:"keyword",then:"script_beforeAttrName"},{regex:/^[a-zA-Z]/,tag:"keyword",then:"tagName"},{regex:/^(?=.)/,tag:"plain",then:"start"}],scriptData:[{regex:/^<(?=\/script>)/i,tag:"operator",then:"tagOpen"},{regex:/^[^<]+/,tag:"plain"}],endTagOpen:[{regex:/^[a-zA-Z]/,tag:"keyword",then:"tagName"},{regex:/^>/,tag:"error",then:"start"},{regex:/^./,tag:"error",then:"bogusComment"}],tagName:[{regex:/^\s+/,
-tag:"plain",then:"normal_beforeAttrName"},{regex:/^\//,tag:"operator",then:"normal_selfClosingStartTag"},{regex:/^>/,tag:"operator",then:"start"},{regex:/^[^ \t\n\/>]+/,tag:"keyword"}],bogusComment:[{regex:/^[^>]+/,tag:"comment"},{regex:/^>/,tag:"comment",then:"start"}],markupDeclarationOpen:[{regex:/^doctype/i,tag:"directive",then:"doctype"},{regex:/^(?=.)/,tag:"comment",then:"bogusComment"}],commentStart:[{regex:/^--\>/,tag:"comment",then:"start"},{regex:/^[^-]+/,tag:"comment"}],doctype:[{regex:/^\s/,
-tag:"plain",then:"beforeDoctypeName"},{regex:/^./,tag:"error",then:"beforeDoctypeName"}],beforeDoctypeName:[{regex:/^\s+/,tag:"plain"},{regex:/^>/,tag:"error",then:"start"},{regex:/^./,tag:"directive",then:"doctypeName"}],doctypeName:[{regex:/^\s/,tag:"plain",then:"afterDoctypeName"},{regex:/^>/,tag:"directive",then:"start"},{regex:/^[^ \t\n>]+/,tag:"directive"}],afterDoctypeName:[{regex:/^\s+/,tag:"directive"},{regex:/^>/,tag:"directive",then:"start"},{regex:/^public/i,tag:"directive",then:"afterDoctypePublicKeyword"},
-{regex:/^system/i,tag:"directive",then:"afterDoctypeSystemKeyword"},{regex:/^./,tag:"error",then:"bogusDoctype"}],afterDoctypePublicKeyword:[{regex:/^\s+/,tag:"plain",then:"beforeDoctypePublicId"},{regex:/^"/,tag:"error",then:"doctypePublicIdQQ"},{regex:/^'/,tag:"error",then:"doctypePublicIdQ"},{regex:/^>/,tag:"error",then:"start"},{regex:/^./,tag:"error",then:"bogusDoctype"}],beforeDoctypePublicId:[{regex:/^\s+/,tag:"plain"},{regex:/^"/,tag:"string",then:"doctypePublicIdQQ"},{regex:/^'/,tag:"string",
-then:"doctypePublicIdQ"},{regex:/^>/,tag:"error",then:"start"},{regex:/^./,tag:"error",then:"bogusDoctype"}],doctypePublicIdQQ:[{regex:/^"/,tag:"string",then:"afterDoctypePublicId"},{regex:/^>/,tag:"error",then:"start"},{regex:/^[^>"]+/,tag:"string"}],doctypePublicIdQ:[{regex:/^'/,tag:"string",then:"afterDoctypePublicId"},{regex:/^>/,tag:"error",then:"start"},{regex:/^[^>']+/,tag:"string"}],afterDoctypePublicId:[{regex:/^\s/,tag:"plain",then:"betweenDoctypePublicAndSystemIds"},{regex:/^>/,tag:"directive",
-then:"start"},{regex:/^"/,tag:"error",then:"doctypeSystemIdQQ"},{regex:/^'/,tag:"error",then:"doctypeSystemIdQ"},{regex:/^./,tag:"error",then:"bogusDoctype"}],betweenDoctypePublicAndSystemIds:[{regex:/^\s+/,tag:"plain",then:"betweenDoctypePublicAndSystemIds"},{regex:/^>/,tag:"directive",then:"start"},{regex:/^"/,tag:"string",then:"doctypeSystemIdQQ"},{regex:/^'/,tag:"string",then:"doctypeSystemIdQ"},{regex:/^./,tag:"error",then:"bogusDoctype"}],afterDoctypeSystemKeyword:[{regex:/^\s/,tag:"plain",
-then:"beforeDoctypeSystemId"},{regex:/^"/,tag:"error",then:"doctypeSystemIdQQ"},{regex:/^'/,tag:"error",then:"doctypeSystemIdQ"},{regex:/^>/,tag:"error",then:"start"},{regex:/^./,tag:"error",then:"bogusDoctype"}],beforeDoctypeSystemId:[{regex:/^\s+/,tag:"plain",then:"beforeDoctypeSystemId"},{regex:/^"/,tag:"string",then:"doctypeSystemIdQQ"},{regex:/^'/,tag:"string",then:"doctypeSystemIdQ"},{regex:/^>/,tag:"error",then:"start"},{regex:/./,tag:"error",then:"bogusDoctype"}],doctypeSystemIdQQ:[{regex:/^"/,
-tag:"string",then:"afterDoctypeSystemId"},{regex:/^>/,tag:"error",then:"start"},{regex:/^[^">]+/,tag:"string"}],doctypeSystemIdQ:[{regex:/^'/,tag:"string",then:"afterDoctypeSystemId"},{regex:/^>/,tag:"error",then:"start"},{regex:/^[^'>]+/,tag:"string"}],afterDoctypeSystemId:[{regex:/^\s+/,tag:"plain"},{regex:/^>/,tag:"directive",then:"start"},{regex:/^./,tag:"error",then:"bogusDoctype"}],bogusDoctype:[{regex:/^>/,tag:"directive",then:"start"},{regex:/^[^>]+/,tag:"directive"}]};d("normal","start");
-d("script","start js:start:<\/script>");f.HTMLSyntax=new b(c,["js"])});bespin.tiki.register("::js_syntax",{name:"js_syntax",dependencies:{standard_syntax:"0.0.0"}});
-bespin.tiki.module("js_syntax:index",function(b,f){b=b("standard_syntax").StandardSyntax;f.JSSyntax=new b({start:[{regex:/^var(?=\s*([A-Za-z_$][A-Za-z0-9_$]*)\s*=\s*require\s*\(\s*['"]([^'"]*)['"]\s*\)\s*[;,])/,tag:"keyword",symbol:"$1:$2"},{regex:/^(?:break|case|catch|continue|default|delete|do|else|false|finally|for|function|if|in|instanceof|let|new|null|return|switch|this|throw|true|try|typeof|var|void|while|with)(?![a-zA-Z0-9_])/,tag:"keyword"},{regex:/^[A-Za-z_][A-Za-z0-9_]*/,tag:"plain"},{regex:/^[^'"\/ \tA-Za-z0-9_]+/,
-tag:"plain"},{regex:/^[ \t]+/,tag:"plain"},{regex:/^'(?=.)/,tag:"string",then:"qstring"},{regex:/^"(?=.)/,tag:"string",then:"qqstring"},{regex:/^\/\/.*/,tag:"comment"},{regex:/^\/\*/,tag:"comment",then:"comment"},{regex:/^./,tag:"plain"}],qstring:[{regex:/^(?:\\.|[^'\\])*'?/,tag:"string",then:"start"}],qqstring:[{regex:/^(?:\\.|[^"\\])*"?/,tag:"string",then:"start"}],comment:[{regex:/^[^*\/]+/,tag:"comment"},{regex:/^\*\//,tag:"comment",then:"start"},{regex:/^[*\/]/,tag:"comment"}]})});
-bespin.tiki.register("::standard_syntax",{name:"standard_syntax",dependencies:{syntax_worker:"0.0.0",syntax_directory:"0.0.0",underscore:"0.0.0"}});
-bespin.tiki.module("standard_syntax:index",function(b,f){b("bespin:promise");var c=b("underscore")._;b("bespin:console");b("syntax_directory");f.StandardSyntax=function(d,a){this.states=d;this.subsyntaxes=a};f.StandardSyntax.prototype={get:function(d,a,e){var m=d[0],n=d[1];if(!this.states.hasOwnProperty(n))throw new Error('StandardSyntax: no such state "'+n+'"');var o=a.substring(e),l={start:e,state:d},p=null;c(this.states[n]).each(function(j){var q=j.regex.exec(o);if(q!=null){var g=q[0].length;l.end=
-e+g;l.tag=j.tag;var i=null;if(j.hasOwnProperty("symbol")){i=/^([^:]+):(.*)/.exec(j.symbol.replace(/\$([0-9]+)/g,function(t,k){return q[k]}));i=[i[1],i[2]]}var r=null;if(j.hasOwnProperty("then")){g=j.then.split(" ");j=[m,g[0]];if(g.length>1)r=g[1].split(":")}else if(g===0)throw new Error("StandardSyntax: Infinite loop detected: zero-length match that didn't change state");else j=d;p={state:j,token:l,symbol:i};if(r!=null)p.newContext=r;c.breakLoop()}});return p}}});
-bespin.metadata={js_syntax:{resourceURL:"resources/js_syntax/",name:"js_syntax",environments:{worker:true},dependencies:{standard_syntax:"0.0.0"},testmodules:[],provides:[{pointer:"#JSSyntax",ep:"syntax",fileexts:["js","json"],name:"js"}],type:"plugins/supported",description:"JavaScript syntax highlighter"},stylesheet:{resourceURL:"resources/stylesheet/",name:"stylesheet",environments:{worker:true},dependencies:{standard_syntax:"0.0.0"},testmodules:[],provides:[{pointer:"#CSSSyntax",ep:"syntax",fileexts:["css",
-"less"],name:"css"}],type:"plugins/supported",description:"CSS syntax highlighter"},syntax_worker:{resourceURL:"resources/syntax_worker/",description:"Coordinates multiple syntax engines",environments:{worker:true},dependencies:{syntax_directory:"0.0.0",underscore:"0.0.0"},testmodules:[],type:"plugins/supported",name:"syntax_worker"},standard_syntax:{resourceURL:"resources/standard_syntax/",description:"Easy-to-use basis for syntax engines",environments:{worker:true},dependencies:{syntax_worker:"0.0.0",
-syntax_directory:"0.0.0",underscore:"0.0.0"},testmodules:[],type:"plugins/supported",name:"standard_syntax"},html:{resourceURL:"resources/html/",name:"html",environments:{worker:true},dependencies:{standard_syntax:"0.0.0"},testmodules:[],provides:[{pointer:"#HTMLSyntax",ep:"syntax",fileexts:["htm","html"],name:"html"}],type:"plugins/supported",description:"HTML syntax highlighter"}};
-if(typeof window!=="undefined")throw new Error('"worker.js can only be loaded in a web worker. Use the "worker_manager" plugin to instantiate web workers.');var messageQueue=[],target=null;if(typeof bespin==="undefined")bespin={};
-function pump(){if(messageQueue.length!==0){var b=messageQueue[0];switch(b.op){case "load":var f=b.base;bespin.base=f;bespin.hasOwnProperty("tiki")||importScripts(f+"tiki.js");if(!bespin.bootLoaded){importScripts(f+"plugin/register/boot");bespin.bootLoaded=true}var c=bespin.tiki.require;c.loader.sources[0].xhr=true;c.ensurePackage("::bespin",function(){var a=c("bespin:plugins").catalog,e=c("bespin:promise").Promise;if(bespin.hasOwnProperty("metadata")){a.registerMetadata(bespin.metadata);a=new e;
-a.resolve()}else a=a.loadMetadataFromURL("plugin/register/worker");a.then(function(){c.ensurePackage(b.pkg,function(){target=c(b.module)[b.target];messageQueue.shift();pump()})})});break;case "invoke":f=function(a){postMessage(JSON.stringify({op:"finish",id:b.id,result:a}));messageQueue.shift();pump()};if(!target.hasOwnProperty(b.method))throw new Error("No such method: "+b.method);var d=target[b.method].apply(target,b.args);typeof d==="object"&&d.isPromise?d.then(f,function(a){throw a;}):f(d);break}}}
-onmessage=function(b){messageQueue.push(JSON.parse(b.data));messageQueue.length===1&&pump()};
deleted file mode 100644
--- a/mail/test/resources/mozmill/mozmill/extension/content/editor/bespin/resources/screen_theme/theme.less
+++ /dev/null
@@ -1,268 +0,0 @@
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Bespin.
- *
- * The Initial Developer of the Original Code is
- * Mozilla.
- * Portions created by the Initial Developer are Copyright (C) 2009
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- * Bespin Team (bespin@mozilla.com)
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-.bespin {
- .container {
- font-family: @container_font;
- font-size: @container_font_size;
-
- color: @container_color;
- background: @container_bg;
- line-height: @container_line_height;
-
- display: -moz-box;
- -moz-box-orient: vertical;
- display: -webkit-box;
- -webkit-box-orient: vertical;
- width: 100%;
- height: 100%;
- margin: 0;
- }
-
- .container .north {
- -moz-box-ordinal-group: 1;
- -webkit-box-ordinal-group: 1;
- }
-
- .container .center-container {
- display: -moz-box;
- -moz-box-orient: horizontal;
- -moz-box-ordinal-group: 2;
- -moz-box-flex: 1;
- display: -webkit-box;
- -webkit-box-orient: horizontal;
- -webkit-box-ordinal-group: 2;
- -webkit-box-flex: 1;
- }
-
- .container .south {
- -moz-box-ordinal-group: 3;
- -webkit-box-ordinal-group: 3;
- }
-
- .container .center-container .west {
- -moz-box-ordinal-group: 1;
- -webkit-box-ordinal-group: 1;
- }
-
- .container .center-container .center {
- -moz-box-flex: 1;
- -moz-box-ordinal-group: 2;
- -webkit-box-flex: 1;
- -webkit-box-ordinal-group: 2;
- }
-
- .container .center-container .east {
- -moz-box-ordinal-group: 3;
- -webkit-box-ordinal-group: 3;
- }
-
- input, textarea {
- display: block;
- border: 0px;
- width: 200px;
- padding: 4px;
- color: @control_color;
- background: @control_bg;
- border: @control_border;
- font-size: 8pt;
- -moz-border-radius: @control_border_radius;
- -webkit-border-radius: @control_border_radius;
- box-shadow:
- rgba(255,255,255,0.3) 0px 0px 2px,
- inset rgba(0,0,0,0.3) 0px 0px 4px;
- -moz-box-shadow:
- rgba(255,255,255,0.3) 0px 0px 2px,
- inset rgba(0,0,0,0.3) 0px 0px 4px;
- -webkit-box-shadow:
- rgba(255,255,255,0.3) 0px 0px 2px,
- inset rgba(0,0,0,0.3) 0px 0px 4px;
- }
-
- input:focus, textarea:focus {
- color: @control_active_color;
- border: @control_active_border;
- background: @control_active_bg;
- outline: none;
- box-shadow: opacity(@control_active_inset_color, 0.6) 0px 0px 2px,
- inset opacity(@control_active_inset_color, 0.3) 0px 0px 6px;
- -moz-box-shadow: opacity(@control_active_inset_color, 0.6) 0px 0px 2px,
- inset opacity(@control_active_inset_color, 0.3) 0px 0px 6px;
- -webkit-box-shadow: opacity(@control_active_inset_color, 0.6) 0px 0px 2px,
- inset opacity(@control_active_inset_color, 0.3) 0px 0px 6px;
- }
-
- input[type=submit], input[type=button] {
- font-family: @button_font;
- font-size: @button_font_size;
- text-shadow: 1px 1px rgba(0, 0, 0, 0.4);
-
- padding: 8px 12px;
- margin-left: 8px;
- color: @button_color;
- background: transparent -moz-linear-gradient(top, @button_bg, @button_bg2);
- background: transparent -webkit-gradient(linear, 50% 0%, 50% 100%, from(@button_bg), to(@button_bg2));
-
- border: 1px solid @button_border;
- -moz-border-radius: @control_border_radius;
- -webkit-border-radius: @control_border_radius;
- -moz-box-shadow:
- inset rgba(255, 255, 255, 0.2) 0 1px 0px,
- inset rgba(0, 0, 0, 0.2) 0 -1px 0px,
- rgba(0, 0, 0, 0.1) 0px 1px 2px;
- -webkit-box-shadow:
- inset rgba(255, 255, 255, 0.2) 0 1px 0px,
- inset rgba(0, 0, 0, 0.2) 0 -1px 0px,
- rgba(0, 0, 0, 0.1) 0px 1px 2px;
- box-shadow:
- inset rgba(255, 255, 255, 0.2) 0 1px 0px,
- inset rgba(0, 0, 0, 0.2) 0 -1px 0px,
- rgba(0, 0, 0, 0.1) 0px 1px 2px;
- }
-
- .pane {
- font-size: @pane_font_size;
- font-family: @pane_font;
- border-top: 1px solid rgba(255,255,255,0.1);
- border-left: 1px solid rgba(0, 0, 0, 0.1);
- border-right: 1px solid rgba(0, 0, 0, 0.1);
- border-bottom: 2px solid rgba(0, 0, 0, 0.1);
- background-color: @pane_bg;
- overflow: visible;
- padding: 15px;
-
- color: @pane_color;
- line-height: @pane_line_height;
-
- margin-bottom: 6px;
- margin-top: 6px;
- text-shadow: @pane_text_shadow;
-
- -moz-border-radius: @pane_border_radius;
- -webkit-border-radius: @pane_border_radius;
- -moz-box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 2px;
- -webkit-box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 2px;
-
- a {
- color: @pane_a_color;
- }
-
- h1 {
- font-family: @pane_h1_font;
- font-size: @pane_h1_font_size;
- color: @pane_h1_color;
-
- letter-spacing: -1.25px;
- line-height: 1.0;
- margin-top: 0px;
- margin-left: 10px;
- margin-bottom: 25px;
- margin-top: 10px;
- text-shadow: @pane_text_shadow;
- }
-
- p {
- margin-left: 10px;
- }
- }
-
-
- .form {
- font-family: @form_font;
- font-size: @form_font_size;
- line-height: @form_line_height;
- color: @form_color;
- text-shadow: @form_text_shadow;
-
- fieldset, p {
- color: @form_color;
- margin-bottom: 6px;
- margin-top: 6px;
- text-shadow: form_text_shadow;
- }
- }
-
- /*
- * The state classes are a little bit complex, because of the doubble class bug in IE6
- * The state class looks like this:
- *
- * .ui-radio-state[-checked][-disabled][-hover] or .ui-checkbox-state[-checked][-disabled][-hover]
- *
- * Examples:
- *
- * .ui-radio-state-checked (simply checked)
- * .ui-radio-state-checked-hover (checked and hovered/focused)
- * .ui-radio-state-hover (unchecked and hovered/focused)
- *
- * If you don´t have to deal with the doubble class bug of IE6 you can also use the simple ui-checkbox-checked, ui-checkbox-disabled, ui-checkbox-hover state-classnames (or: ui-radio-checked...)
- * and the ui-radio/ui-checkbox role-classnames.
- *
- */
-
- span.ui-checkbox,
- span.ui-radio {
- display: block;
- float: left;
- width: 24px;
- height: 24px;
- background: url(images/radio-unselected.png) no-repeat;
- }
-
- span.ui-checkbox {
- background: url(images/check-unselected.png) no-repeat;
- }
-
- span.ui-helper-hidden {
- display: none;
- }
-
- span.ui-checkbox-state-checked,
- span.ui-checkbox-state-checked-hover {
- background: url(images/check-selected.png) no-repeat;
- }
-
- span.ui-radio-state-checked,
- span.ui-radio-state-checked-hover {
- background: url(images/radio-selected.png) no-repeat;
- }
-
- .ui-helper-hidden-accessible {
- position: absolute;
- left: -999em;
- }
-}
-
deleted file mode 100644
--- a/mail/test/resources/mozmill/mozmill/extension/content/editor/editor.js
+++ /dev/null
@@ -1,152 +0,0 @@
-var editor = {
- index : 0,
-
- tabs : [],
-
- currentTab : null,
-
- tempCount : 0,
-
- resize : function(width, height) {
- if(width)
- this.width = width;
- if(height)
- this.height = height;
-
- if(this.currentTab) {
- $(this.currentTab.editorElement).width(this.width);
- $(this.currentTab.editorElement).height(this.height);
- this.currentTab.editorEnv.dimensionsChanged();
- }
- },
-
- switchTab : function(index) {
- if(index == undefined)
- index = this.tabs.length - 1;
- if(index < 0)
- return;
-
- var tabSelect = document.getElementById("editor-tab-select");
- tabSelect.selectedIndex = index;
-
- if(this.currentTab)
- $(this.currentTab.editorElement).hide();
-
- this.index = index;
- this.currentTab = this.tabs[index];
- this.resize();
- $(this.currentTab.editorElement).show();
- this.currentTab.editor.focus = true;
- this.currentTab.editorEnv.dimensionsChanged()
- },
-
- closeCurrentTab : function() {
- this.currentTab.destroy();
- this.currentTab = '';
- this.tabs.splice(this.index, 1);
-
- var tabSelect = document.getElementById("editor-tab-select");
- var option = tabSelect.getElementsByTagName("option")[this.index];
- tabSelect.removeChild(option);
-
- this.switchTab();
- },
-
- getTabForFile : function(filename) {
- for(var i = 0; i < this.tabs.length; i++) {
- if(this.tabs[i].filename == filename)
- return i;
- }
- return -1;
- },
-
- openNew : function(content, filename) {
- if(!filename) {
- this.tempCount++;
- filename = utils.tempfile("mozmill.utils.temp" + this.tempCount).path;
- var tabName = "temp " + this.tempCount;
- }
- else
- var tabName = getBasename(filename);
-
- var option = $('<option></option>').val(this.tabs.length - 1).html(tabName);
- $("#editor-tab-select").append(option);
-
- var newTab = new editorTab(content, filename);
- this.tabs.push(newTab);
-
- // will switch to tab when it has loaded
- },
-
- getContent : function() {
- return this.currentTab.getContent();
- },
-
- setContent : function(content) {
- this.currentTab.setContent(content);
- },
-
- getFilename : function() {
- return this.currentTab.filename;
- },
-
- showFilename : function(filename) {
- $("#editor-tab-select option").eq(editor.index).html(filename);
- },
-
- changeFilename : function(filename) {
- this.currentTab.filename = filename;
- this.showFilename(getBasename(filename));
- },
-
- onFileChanged : function() {
- var selected = $("#editor-tab-select :selected");
- selected.html(selected.html().replace("*", "")).append("*");
-
- // remove listener until saving to prevent typing slow down
- editor.currentTab.editor.textChanged.remove(editor.onFileChanged);
- },
-
- onFileSaved : function() {
- var selected = $("#editor-tab-select :selected");
- selected.html(selected.html().replace("*", ""));
- editor.currentTab.editor.textChanged.add(editor.onFileChanged);
- }
-}
-
-
-function editorTab(content, filename) {
- var elem = $("<pre></pre>").addClass("bespin").appendTo("#editors");
- elem.val(content);
- var bespinElement = elem.get(0);
- var editorObject = this;
-
- bespin.useBespin(bespinElement, {
- settings: {"tabstop": 4},
- syntax: "js",
- stealFocus: true})
- .then(function(env) {
- editorObject.editorEnv = env;
- editorObject.editor = env.editor;
- env.editor.textChanged.add(editor.onFileChanged);
- editor.switchTab();
- env.settings.set("fontsize", 13);
- });
-
- this.editorElement = bespinElement;
- this.filename = filename;
-}
-
-editorTab.prototype = {
- setContent : function(content) {
- this.editor.value = content;
- },
-
- getContent : function() {
- return this.editor.value;
- },
-
- destroy : function() {
- this.editorElement.parentNode.removeChild(this.editorElement);
- }
-}
deleted file mode 100644
index 44a1ef531f7f4c9c425c557a071c5159e70bb5fd..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
--- a/mail/test/resources/mozmill/mozmill/extension/content/inspector.js
+++ /dev/null
@@ -1,63 +0,0 @@
-var utils = {}; Components.utils.import('resource://mozmill/modules/utils.js', utils);
-
-
-
-var showFileDialog = function(){
- $("#fileDialog").dialog("open");
-}
-
-var showTestDialog = function(){
- $("#testDialog").dialog("open");
-}
-
-var showOptionDialog = function(){
- $("#optionDialog").dialog("open");
-}
-
-var showHelpDialog = function(){
- $("#helpDialog").dialog("open");
-}
-
-var showRecordDialog = function(){
- $("#tabs").tabs().tabs("select", 0);
- $("#recordDialog").dialog("open");
- MozMillrec.on();
- $("#recordDialog").dialog().parents(".ui-dialog:first").find(".ui-dialog-buttonpane button")[1].innerHTML = "Stop";
-}
-
-//Align mozmill to all the other open windows in a way that makes it usable
-var align = function(){
- var enumerator = Components.classes["@mozilla.org/appshell/window-mediator;1"]
- .getService(Components.interfaces.nsIWindowMediator)
- .getEnumerator("");
- while(enumerator.hasMoreElements()) {
- var win = enumerator.getNext();
- if (win.document.title != 'MozMill IDE'){
- var wintype = win.document.documentElement.getAttribute("windowtype");
- //move to top left corner
- win.screenY = 0;
- win.screenX = 0;
-
- //make only browser windows big
- if (wintype == "navigator:browser"){
- var width = window.screen.availWidth/2.5;
- var height = window.screen.availHeight;
- win.resizeTo((window.screen.availWidth - width), window.screen.availHeight);
- }
- }
- else {
- var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
- .getService(Components.interfaces.nsIWindowMediator);
- var latestbrowser = wm.getMostRecentWindow('navigator:browser');
-
- //if there is no most recent browser window, use whatever window
- if (!latestbrowser){
- var latestbrowser = wm.getMostRecentWindow('');
- }
-
- win.screenX = latestbrowser.innerWidth;
- win.screenY = 0;
- }
- }
- return true;
-};
deleted file mode 100644
--- a/mail/test/resources/mozmill/mozmill/extension/content/jquery/fg.menu.css
+++ /dev/null
@@ -1,114 +0,0 @@
-/* Styles for jQuery menu widget
-Author: Maggie Wachs, maggie@filamentgroup.com
-Date: September 2008
-*/
-
-
-/* REQUIRED STYLES - the menus will only render correctly with these rules */
-
-.fg-menu-container { position: absolute; top:0; left:-999px; padding: .4em; overflow: hidden; }
-.fg-menu-container.fg-menu-flyout { overflow: visible; }
-
-.fg-menu, .fg-menu ul { list-style-type:none; padding: 0; margin:0; }
-
-.fg-menu { position:relative; }
-.fg-menu-flyout .fg-menu { position:static; }
-
-.fg-menu ul { position:absolute; top:0; }
-.fg-menu ul ul { top:-1px; }
-
-.fg-menu-container.fg-menu-ipod .fg-menu-content,
-.fg-menu-container.fg-menu-ipod .fg-menu-content ul { background: none !important; }
-
-.fg-menu.fg-menu-scroll,
-.fg-menu ul.fg-menu-scroll { overflow: scroll; overflow-x: hidden; }
-
-.fg-menu li { clear:both; float:left; width:100%; margin: 0; padding:0; border: 0; }
-.fg-menu li li { font-size:1em; } /* inner li font size must be reset so that they don't blow up */
-
-.fg-menu-flyout ul ul { padding: .4em; }
-.fg-menu-flyout li { position:relative; }
-
-.fg-menu-scroll { overflow: scroll; overflow-x: hidden; }
-
-.fg-menu-breadcrumb { margin: 0; padding: 0; }
-
-.fg-menu-footer { margin-top: .4em; padding: .4em; }
-.fg-menu-header { margin-bottom: .4em; padding: .4em; }
-
-.fg-menu-breadcrumb li { float: left; list-style: none; margin: 0; padding: 0 .2em; font-size: .9em; opacity: .7; }
-.fg-menu-breadcrumb li.fg-menu-prev-list,
-.fg-menu-breadcrumb li.fg-menu-current-crumb { clear: left; float: none; opacity: 1; }
-.fg-menu-breadcrumb li.fg-menu-current-crumb { padding-top: .2em; }
-
-.fg-menu-breadcrumb a,
-.fg-menu-breadcrumb span { float: left; }
-
-.fg-menu-footer a:link,
-.fg-menu-footer a:visited { float:left; width:100%; text-decoration: none; }
-.fg-menu-footer a:hover,
-.fg-menu-footer a:active { }
-
-.fg-menu-footer a span { float:left; cursor: pointer; }
-
-.fg-menu-breadcrumb .fg-menu-prev-list a:link,
-.fg-menu-breadcrumb .fg-menu-prev-list a:visited,
-.fg-menu-breadcrumb .fg-menu-prev-list a:hover,
-.fg-menu-breadcrumb .fg-menu-prev-list a:active { background-image: none; text-decoration:none; }
-
-.fg-menu-breadcrumb .fg-menu-prev-list a { float: left; padding-right: .4em; }
-.fg-menu-breadcrumb .fg-menu-prev-list a .ui-icon { float: left; }
-
-.fg-menu-breadcrumb .fg-menu-current-crumb a:link,
-.fg-menu-breadcrumb .fg-menu-current-crumb a:visited,
-.fg-menu-breadcrumb .fg-menu-current-crumb a:hover,
-.fg-menu-breadcrumb .fg-menu-current-crumb a:active { display:block; background-image:none; font-size:1.3em; text-decoration:none; }
-
-
-
-/* REQUIRED LINK STYLES: links are "display:block" by default; if the menu options are split into
- selectable node links and 'next' links, the script floats the node links left and floats the 'next' links to the right */
-
-.fg-menu a:link,
-.fg-menu a:visited,
-.fg-menu a:hover,
-.fg-menu a:active { float:left; width:92%; padding:.3em 3%; text-decoration:none; outline: 0 !important; }
-
-.fg-menu a { border: 1px dashed transparent; }
-
-.fg-menu a.ui-state-default:link,
-.fg-menu a.ui-state-default:visited,
-.fg-menu a.ui-state-default:hover,
-.fg-menu a.ui-state-default:active,
-.fg-menu a.ui-state-hover:link,
-.fg-menu a.ui-state-hover:visited,
-.fg-menu a.ui-state-hover:hover,
-.fg-menu a.ui-state-hover:active,
- .fg-menu a.ui-state-active:link,
- .fg-menu a.ui-state-active:visited,
- .fg-menu a.ui-state-active:hover,
-.fg-menu a.ui-state-active:active { border-style: solid; font-weight: normal; }
-
-.fg-menu a span { display:block; cursor:pointer; }
-
-
- /* SUGGESTED STYLES - for use with jQuery UI Themeroller CSS */
-
-.fg-menu-indicator span { float:left; }
-.fg-menu-indicator span.ui-icon { float:right; }
-
-.fg-menu-content.ui-widget-content,
-.fg-menu-content ul.ui-widget-content { border:0; }
-
-
-/* ICONS AND DIVIDERS */
-
-.fg-menu.fg-menu-has-icons a:link,
-.fg-menu.fg-menu-has-icons a:visited,
-.fg-menu.fg-menu-has-icons a:hover,
-.fg-menu.fg-menu-has-icons a:active { padding-left:20px; }
-
-.fg-menu .horizontal-divider hr, .fg-menu .horizontal-divider span { padding:0; margin:5px .6em; }
-.fg-menu .horizontal-divider hr { border:0; height:1px; }
-.fg-menu .horizontal-divider span { font-size:.9em; text-transform: uppercase; padding-left:.2em; }
-
deleted file mode 100644
--- a/mail/test/resources/mozmill/mozmill/extension/content/jquery/fg.menu.js
+++ /dev/null
@@ -1,510 +0,0 @@
-/*--------------------------------------------------------------------
-Scripts for creating and manipulating custom menus based on standard <ul> markup
-Version: 3.0, 03.31.2009
-
-By: Maggie Costello Wachs (maggie@filamentgroup.com) and Scott Jehl (scott@filamentgroup.com)
- http://www.filamentgroup.com
- * reference articles: http://www.filamentgroup.com/lab/jquery_ipod_style_drilldown_menu/
-
-Copyright (c) 2009 Filament Group
-Dual licensed under the MIT (filamentgroup.com/examples/mit-license.txt) and GPL (filamentgroup.com/examples/gpl-license.txt) licenses.
---------------------------------------------------------------------*/
-
-
-var allUIMenus = [];
-
-$.fn.menu = function(options){
- var caller = this;
- var options = options;
- var m = new Menu(caller, options);
- allUIMenus.push(m);
-
- $(this)
- .mousedown(function(){
- if (!m.menuOpen) { m.showLoading(); };
- })
- .click(function(){
- if (m.menuOpen == false) { m.showMenu(); }
- else { m.kill(); };
- return false;
- });
-};
-
-function Menu(caller, options){
- var menu = this;
- var caller = $(caller);
- var container = $('<div class="fg-menu-container ui-widget ui-widget-content ui-corner-all">'+options.content+'</div>');
-
- this.menuOpen = false;
- this.menuExists = false;
-
- caller.showMenu = this.showMenu; // for keyboard accessiblity
-
- var options = jQuery.extend({
- content: null,
- width: 180, // width of menu container, must be set or passed in to calculate widths of child menus
- maxHeight: 180, // max height of menu (if a drilldown: height does not include breadcrumb)
- positionOpts: {
- posX: 'left',
- posY: 'bottom',
- offsetX: 0,
- offsetY: 0,
- directionH: 'right',
- directionV: 'down',
- detectH: true, // do horizontal collision detection
- detectV: true, // do vertical collision detection
- linkToFront: false
- },
- showSpeed: 200, // show/hide speed in milliseconds
- callerOnState: 'ui-state-active', // class to change the appearance of the link/button when the menu is showing
- loadingState: 'ui-state-loading', // class added to the link/button while the menu is created
- linkHover: 'ui-state-hover', // class for menu option hover state
- linkHoverSecondary: 'li-hover', // alternate class, may be used for multi-level menus
- // ----- multi-level menu defaults -----
- crossSpeed: 200, // cross-fade speed for multi-level menus
- crumbDefaultText: 'Choose an option:',
- backLink: true, // in the ipod-style menu: instead of breadcrumbs, show only a 'back' link
- backLinkText: 'Back',
- flyOut: false, // multi-level menus are ipod-style by default; this parameter overrides to make a flyout instead
- flyOutOnState: 'ui-state-default',
- nextMenuLink: 'ui-icon-triangle-1-e', // class to style the link (specifically, a span within the link) used in the multi-level menu to show the next level
- topLinkText: 'All',
- nextCrumbLink: 'ui-icon-carat-1-e'
- }, options);
-
- var killAllMenus = function(){
- $.each(allUIMenus, function(i){
- if (allUIMenus[i].menuOpen) { allUIMenus[i].kill(); };
- });
- };
-
- this.kill = function(){
- caller
- .removeClass(options.loadingState)
- .removeClass('fg-menu-open')
- .removeClass(options.callerOnState);
- container.find('li').removeClass(options.linkHoverSecondary).find('a').removeClass(options.linkHover);
- if (options.flyOutOnState) { container.find('li a').removeClass(options.flyOutOnState); };
- if (options.callerOnState) { caller.removeClass(options.callerOnState); };
- if (container.is('.fg-menu-ipod')) { menu.resetDrilldownMenu(); };
- if (container.is('.fg-menu-flyout')) { menu.resetFlyoutMenu(); };
- container.parent().hide();
- menu.menuOpen = false;
- $(document).unbind('click', killAllMenus);
- $(document).unbind('keydown');
- };
-
- this.showLoading = function(){
- caller.addClass(options.loadingState);
- };
-
- this.showMenu = function(){
- killAllMenus();
- if (!menu.menuExists) { menu.create() };
- caller
- .addClass('fg-menu-open')
- .addClass(options.callerOnState);
- container.parent().show().click(function(){ menu.kill(); return false; });
- container.hide().slideDown(options.showSpeed).find('.fg-menu:eq(0)');
- menu.menuOpen = true;
- caller.removeClass(options.loadingState);
- $(document).click(killAllMenus);
-
- // assign key events
- $(document).keydown(function(event){
- var e;
- if (event.which !="") { e = event.which; }
- else if (event.charCode != "") { e = event.charCode; }
- else if (event.keyCode != "") { e = event.keyCode; }
-
- var menuType = ($(event.target).parents('div').is('.fg-menu-flyout')) ? 'flyout' : 'ipod' ;
-
- switch(e) {
- case 37: // left arrow
- if (menuType == 'flyout') {
- $(event.target).trigger('mouseout');
- if ($('.'+options.flyOutOnState).size() > 0) { $('.'+options.flyOutOnState).trigger('mouseover'); };
- };
-
- if (menuType == 'ipod') {
- $(event.target).trigger('mouseout');
- if ($('.fg-menu-footer').find('a').size() > 0) { $('.fg-menu-footer').find('a').trigger('click'); };
- if ($('.fg-menu-header').find('a').size() > 0) { $('.fg-menu-current-crumb').prev().find('a').trigger('click'); };
- if ($('.fg-menu-current').prev().is('.fg-menu-indicator')) {
- $('.fg-menu-current').prev().trigger('mouseover');
- };
- };
- return false;
- break;
-
- case 38: // up arrow
- if ($(event.target).is('.' + options.linkHover)) {
- var prevLink = $(event.target).parent().prev().find('a:eq(0)');
- if (prevLink.size() > 0) {
- $(event.target).trigger('mouseout');
- prevLink.trigger('mouseover');
- };
- }
- else { container.find('a:eq(0)').trigger('mouseover'); }
- return false;
- break;
-
- case 39: // right arrow
- if ($(event.target).is('.fg-menu-indicator')) {
- if (menuType == 'flyout') {
- $(event.target).next().find('a:eq(0)').trigger('mouseover');
- }
- else if (menuType == 'ipod') {
- $(event.target).trigger('click');
- setTimeout(function(){
- $(event.target).next().find('a:eq(0)').trigger('mouseover');
- }, options.crossSpeed);
- };
- };
- return false;
- break;
-
- case 40: // down arrow
- if ($(event.target).is('.' + options.linkHover)) {
- var nextLink = $(event.target).parent().next().find('a:eq(0)');
- if (nextLink.size() > 0) {
- $(event.target).trigger('mouseout');
- nextLink.trigger('mouseover');
- };
- }
- else { container.find('a:eq(0)').trigger('mouseover'); }
- return false;
- break;
-
- case 27: // escape
- killAllMenus();
- break;
-
- case 13: // enter
- if ($(event.target).is('.fg-menu-indicator') && menuType == 'ipod') {
- $(event.target).trigger('click');
- setTimeout(function(){
- $(event.target).next().find('a:eq(0)').trigger('mouseover');
- }, options.crossSpeed);
- };
- break;
- };
- });
- };
-
-
- this.create = function(){
- container.css({ width: options.width }).appendTo('body').find('ul:first').not('.fg-menu-breadcrumb').addClass('fg-menu');
- container.find('ul, li a').addClass('ui-corner-all');
-
- // aria roles & attributes
- container.find('ul').attr('role', 'menu').eq(0).attr('aria-activedescendant','active-menuitem').attr('aria-labelledby', caller.attr('id'));
- container.find('li').attr('role', 'menuitem');
- container.find('li:has(ul)').attr('aria-haspopup', 'true').find('ul').attr('aria-expanded', 'false');
- container.find('a').attr('tabindex', '-1');
-
- // when there are multiple levels of hierarchy, create flyout or drilldown menu
- if (container.find('ul').size() > 1) {
- if (options.flyOut) { menu.flyout(container, options); }
- else { menu.drilldown(container, options); }
- }
- else {
- container.find('li').click(function(){ // Mozmill modified : 'a' to 'li'
- menu.chooseItem(this);
- return false;
- });
- };
-
- if (options.linkHover) {
- var allLinks = container.find('.fg-menu li a');
- allLinks.hover(
- function(){
- var menuitem = $(this);
- $('.'+options.linkHover).removeClass(options.linkHover).blur().parent().removeAttr('id');
- $(this).addClass(options.linkHover).focus().parent().attr('id','active-menuitem');
- },
- function(){
- $(this).removeClass(options.linkHover).blur().parent().removeAttr('id');
- }
- );
- };
-
- if (options.linkHoverSecondary) {
- container.find('.fg-menu li').hover(
- function(){
- $(this).siblings('li').removeClass(options.linkHoverSecondary);
- if (options.flyOutOnState) { $(this).siblings('li').find('a').removeClass(options.flyOutOnState); }
- $(this).addClass(options.linkHoverSecondary);
- },
- function(){ $(this).removeClass(options.linkHoverSecondary); }
- );
- };
-
- menu.setPosition(container, caller, options);
- menu.menuExists = true;
- };
-
- this.chooseItem = function(item){
- menu.kill();
- // edit this for your own custom function/callback:
- $('#menuSelection').text($(item).text());
- // location.href = $(item).attr('href');
- };
-};
-
-Menu.prototype.flyout = function(container, options) {
- var menu = this;
-
- this.resetFlyoutMenu = function(){
- var allLists = container.find('ul ul');
- allLists.removeClass('ui-widget-content').hide();
- };
-
- container.addClass('fg-menu-flyout').find('li:has(ul)').each(function(){
- var linkWidth = container.width();
- var showTimer, hideTimer;
- var allSubLists = $(this).find('ul');
-
- allSubLists.css({ left: linkWidth, width: linkWidth }).hide();
-
- $(this).find('a:eq(0)').addClass('fg-menu-indicator').html('<span>' + $(this).find('a:eq(0)').text() + '</span><span class="ui-icon '+options.nextMenuLink+'"></span>').hover(
- function(){
- clearTimeout(hideTimer);
- var subList = $(this).next();
- if (!fitVertical(subList, $(this).offset().top)) { subList.css({ top: 'auto', bottom: 0 }); };
- if (!fitHorizontal(subList, $(this).offset().left + 100)) { subList.css({ left: 'auto', right: linkWidth, 'z-index': 999 }); };
- showTimer = setTimeout(function(){
- subList.addClass('ui-widget-content').show(options.showSpeed).attr('aria-expanded', 'true');
- }, 300);
- },
- function(){
- clearTimeout(showTimer);
- var subList = $(this).next();
- hideTimer = setTimeout(function(){
- subList.removeClass('ui-widget-content').hide(options.showSpeed).attr('aria-expanded', 'false');
- }, 400);
- }
- );
-
- $(this).find('ul a').hover(
- function(){
- clearTimeout(hideTimer);
- if ($(this).parents('ul').prev().is('a.fg-menu-indicator')) {
- $(this).parents('ul').prev().addClass(options.flyOutOnState);
- }
- },
- function(){
- hideTimer = setTimeout(function(){
- allSubLists.hide(options.showSpeed);
- container.find(options.flyOutOnState).removeClass(options.flyOutOnState);
- }, 500);
- }
- );
- });
-
- container.find('a').click(function(){
- menu.chooseItem(this);
- return false;
- });
-};
-
-
-
-
-/* Menu.prototype.setPosition parameters (defaults noted with *):
- referrer = the link (or other element) used to show the overlaid object
- settings = can override the defaults:
- - posX/Y: where the top left corner of the object should be positioned in relation to its referrer.
- X: left*, center, right
- Y: top, center, bottom*
- - offsetX/Y: the number of pixels to be offset from the x or y position. Can be a positive or negative number.
- - directionH/V: where the entire menu should appear in relation to its referrer.
- Horizontal: left*, right
- Vertical: up, down*
- - detectH/V: detect the viewport horizontally / vertically
- - linkToFront: copy the menu link and place it on top of the menu (visual effect to make it look like it overlaps the object) */
-
-Menu.prototype.setPosition = function(widget, caller, options) {
- var el = widget;
- var referrer = caller;
- var dims = {
- refX: referrer.offset().left,
- refY: referrer.offset().top,
- refW: referrer.getTotalWidth(),
- refH: referrer.getTotalHeight()
- };
- var options = options;
- var xVal, yVal;
-
- var helper = $('<div class="positionHelper"></div>');
- helper.css({ position: 'absolute', left: dims.refX, top: dims.refY, width: dims.refW, height: dims.refH });
- el.wrap(helper);
-
- // get X pos
- switch(options.positionOpts.posX) {
- case 'left': xVal = 0;
- break;
- case 'center': xVal = dims.refW / 2;
- break;
- case 'right': xVal = dims.refW;
- break;
- };
-
- // get Y pos
- switch(options.positionOpts.posY) {
- case 'top': yVal = 0;
- break;
- case 'center': yVal = dims.refH / 2;
- break;
- case 'bottom': yVal = dims.refH;
- break;
- };
-
- // add the offsets (zero by default)
- xVal += options.positionOpts.offsetX;
- yVal += options.positionOpts.offsetY;
-
- // position the object vertically
- if (options.positionOpts.directionV == 'up') {
- el.css({ top: 'auto', bottom: yVal });
- if (options.positionOpts.detectV && !fitVertical(el)) {
- el.css({ bottom: 'auto', top: yVal });
- }
- }
- else {
- el.css({ bottom: 'auto', top: yVal });
- if (options.positionOpts.detectV && !fitVertical(el)) {
- el.css({ top: 'auto', bottom: yVal });
- }
- };
-
- // and horizontally
- if (options.positionOpts.directionH == 'left') {
- el.css({ left: 'auto', right: xVal });
- if (options.positionOpts.detectH && !fitHorizontal(el)) {
- el.css({ right: 'auto', left: xVal });
- }
- }
- else {
- el.css({ right: 'auto', left: xVal });
- if (options.positionOpts.detectH && !fitHorizontal(el)) {
- el.css({ left: 'auto', right: xVal });
- }
- };
-
- // if specified, clone the referring element and position it so that it appears on top of the menu
- if (options.positionOpts.linkToFront) {
- referrer.clone().addClass('linkClone').css({
- position: 'absolute',
- top: 0,
- right: 'auto',
- bottom: 'auto',
- left: 0,
- width: referrer.width(),
- height: referrer.height()
- }).insertAfter(el);
- };
-};
-
-
-/* Utilities to sort and find viewport dimensions */
-
-function sortBigToSmall(a, b) { return b - a; };
-
-jQuery.fn.getTotalWidth = function(){
- return $(this).width() + parseInt($(this).css('paddingRight')) + parseInt($(this).css('paddingLeft')) + parseInt($(this).css('borderRightWidth')) + parseInt($(this).css('borderLeftWidth'));
-};
-
-jQuery.fn.getTotalHeight = function(){
- return $(this).height() + parseInt($(this).css('paddingTop')) + parseInt($(this).css('paddingBottom')) + parseInt($(this).css('borderTopWidth')) + parseInt($(this).css('borderBottomWidth'));
-};
-
-function getScrollTop(){
- return self.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop;
-};
-
-function getScrollLeft(){
- return self.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft;
-};
-
-function getWindowHeight(){
- var de = document.documentElement;
- return self.innerHeight || (de && de.clientHeight) || document.body.clientHeight;
-};
-
-function getWindowWidth(){
- var de = document.documentElement;
- return self.innerWidth || (de && de.clientWidth) || document.body.clientWidth;
-};
-
-/* Utilities to test whether an element will fit in the viewport
- Parameters:
- el = element to position, required
- leftOffset / topOffset = optional parameter if the offset cannot be calculated (i.e., if the object is in the DOM but is set to display: 'none') */
-
-function fitHorizontal(el, leftOffset){
- var leftVal = parseInt(leftOffset) || $(el).offset().left;
- return (leftVal + $(el).width() <= getWindowWidth() + getScrollLeft() && leftVal - getScrollLeft() >= 0);
-};
-
-function fitVertical(el, topOffset){
- var topVal = parseInt(topOffset) || $(el).offset().top;
- return (topVal + $(el).height() <= getWindowHeight() + getScrollTop() && topVal - getScrollTop() >= 0);
-};
-
-/*--------------------------------------------------------------------
- * javascript method: "pxToEm"
- * by:
- Scott Jehl (scott@filamentgroup.com)
- Maggie Wachs (maggie@filamentgroup.com)
- http://www.filamentgroup.com
- *
- * Copyright (c) 2008 Filament Group
- * Dual licensed under the MIT (filamentgroup.com/examples/mit-license.txt) and GPL (filamentgroup.com/examples/gpl-license.txt) licenses.
- *
- * Description: Extends the native Number and String objects with pxToEm method. pxToEm converts a pixel value to ems depending on inherited font size.
- * Article: http://www.filamentgroup.com/lab/retaining_scalable_interfaces_with_pixel_to_em_conversion/
- * Demo: http://www.filamentgroup.com/examples/pxToEm/
- *
- * Options:
- scope: string or jQuery selector for font-size scoping
- reverse: Boolean, true reverses the conversion to em-px
- * Dependencies: jQuery library
- * Usage Example: myPixelValue.pxToEm(); or myPixelValue.pxToEm({'scope':'#navigation', reverse: true});
- *
- * Version: 2.0, 08.01.2008
- * Changelog:
- * 08.02.2007 initial Version 1.0
- * 08.01.2008 - fixed font-size calculation for IE
---------------------------------------------------------------------*/
-
-Number.prototype.pxToEm = String.prototype.pxToEm = function(settings){
- //set defaults
- settings = jQuery.extend({
- scope: 'body',
- reverse: false
- }, settings);
-
- var pxVal = (this == '') ? 0 : parseFloat(this);
- var scopeVal;
- var getWindowWidth = function(){
- var de = document.documentElement;
- return self.innerWidth || (de && de.clientWidth) || document.body.clientWidth;
- };
-
- /* When a percentage-based font-size is set on the body, IE returns that percent of the window width as the font-size.
- For example, if the body font-size is 62.5% and the window width is 1000px, IE will return 625px as the font-size.
- When this happens, we calculate the correct body font-size (%) and multiply it by 16 (the standard browser font size)
- to get an accurate em value. */
-
- if (settings.scope == 'body' && $.browser.msie && (parseFloat($('body').css('font-size')) / getWindowWidth()).toFixed(1) > 0.0) {
- var calcFontSize = function(){
- return (parseFloat($('body').css('font-size'))/getWindowWidth()).toFixed(3) * 16;
- };
- scopeVal = calcFontSize();
- }
- else { scopeVal = parseFloat(jQuery(settings.scope).css("font-size")); };
-
- var result = (settings.reverse == true) ? (pxVal * scopeVal).toFixed(2) + 'px' : (pxVal / scopeVal).toFixed(2) + 'em';
- return result;
-};
deleted file mode 100644
--- a/mail/test/resources/mozmill/mozmill/extension/content/jquery/jquery-1.3.2.min.js
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * jQuery JavaScript Library v1.3.2
- * http://jquery.com/
- *
- * Copyright (c) 2009 John Resig
- * Dual licensed under the MIT and GPL licenses.
- * http://docs.jquery.com/License
- *
- * Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009)
- * Revision: 6246
- */
-(function(){var l=this,g,y=l.jQuery,p=l.$,o=l.jQuery=l.$=function(E,F){return new o.fn.init(E,F)},D=/^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,f=/^.[^:#\[\.,]*$/;o.fn=o.prototype={init:function(E,H){E=E||document;if(E.nodeType){this[0]=E;this.length=1;this.context=E;return this}if(typeof E==="string"){var G=D.exec(E);if(G&&(G[1]||!H)){if(G[1]){E=o.clean([G[1]],H)}else{var I=document.getElementById(G[3]);if(I&&I.id!=G[3]){return o().find(E)}var F=o(I||[]);F.context=document;F.selector=E;return F}}else{return o(H).find(E)}}else{if(o.isFunction(E)){return o(document).ready(E)}}if(E.selector&&E.context){this.selector=E.selector;this.context=E.context}return this.setArray(o.isArray(E)?E:o.makeArray(E))},selector:"",jquery:"1.3.2",size:function(){return this.length},get:function(E){return E===g?Array.prototype.slice.call(this):this[E]},pushStack:function(F,H,E){var G=o(F);G.prevObject=this;G.context=this.context;if(H==="find"){G.selector=this.selector+(this.selector?" ":"")+E}else{if(H){G.selector=this.selector+"."+H+"("+E+")"}}return G},setArray:function(E){this.length=0;Array.prototype.push.apply(this,E);return this},each:function(F,E){return o.each(this,F,E)},index:function(E){return o.inArray(E&&E.jquery?E[0]:E,this)},attr:function(F,H,G){var E=F;if(typeof F==="string"){if(H===g){return this[0]&&o[G||"attr"](this[0],F)}else{E={};E[F]=H}}return this.each(function(I){for(F in E){o.attr(G?this.style:this,F,o.prop(this,E[F],G,I,F))}})},css:function(E,F){if((E=="width"||E=="height")&&parseFloat(F)<0){F=g}return this.attr(E,F,"curCSS")},text:function(F){if(typeof F!=="object"&&F!=null){return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(F))}var E="";o.each(F||this,function(){o.each(this.childNodes,function(){if(this.nodeType!=8){E+=this.nodeType!=1?this.nodeValue:o.fn.text([this])}})});return E},wrapAll:function(E){if(this[0]){var F=o(E,this[0].ownerDocument).clone();if(this[0].parentNode){F.insertBefore(this[0])}F.map(function(){var G=this;while(G.firstChild){G=G.firstChild}return G}).append(this)}return this},wrapInner:function(E){return this.each(function(){o(this).contents().wrapAll(E)})},wrap:function(E){return this.each(function(){o(this).wrapAll(E)})},append:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.appendChild(E)}})},prepend:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.insertBefore(E,this.firstChild)}})},before:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this)})},after:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this.nextSibling)})},end:function(){return this.prevObject||o([])},push:[].push,sort:[].sort,splice:[].splice,find:function(E){if(this.length===1){var F=this.pushStack([],"find",E);F.length=0;o.find(E,this[0],F);return F}else{return this.pushStack(o.unique(o.map(this,function(G){return o.find(E,G)})),"find",E)}},clone:function(G){var E=this.map(function(){if(!o.support.noCloneEvent&&!o.isXMLDoc(this)){var I=this.outerHTML;if(!I){var J=this.ownerDocument.createElement("div");J.appendChild(this.cloneNode(true));I=J.innerHTML}return o.clean([I.replace(/ jQuery\d+="(?:\d+|null)"/g,"").replace(/^\s*/,"")])[0]}else{return this.cloneNode(true)}});if(G===true){var H=this.find("*").andSelf(),F=0;E.find("*").andSelf().each(function(){if(this.nodeName!==H[F].nodeName){return}var I=o.data(H[F],"events");for(var K in I){for(var J in I[K]){o.event.add(this,K,I[K][J],I[K][J].data)}}F++})}return E},filter:function(E){return this.pushStack(o.isFunction(E)&&o.grep(this,function(G,F){return E.call(G,F)})||o.multiFilter(E,o.grep(this,function(F){return F.nodeType===1})),"filter",E)},closest:function(E){var G=o.expr.match.POS.test(E)?o(E):null,F=0;return this.map(function(){var H=this;while(H&&H.ownerDocument){if(G?G.index(H)>-1:o(H).is(E)){o.data(H,"closest",F);return H}H=H.parentNode;F++}})},not:function(E){if(typeof E==="string"){if(f.test(E)){return this.pushStack(o.multiFilter(E,this,true),"not",E)}else{E=o.multiFilter(E,this)}}var F=E.length&&E[E.length-1]!==g&&!E.nodeType;return this.filter(function(){return F?o.inArray(this,E)<0:this!=E})},add:function(E){return this.pushStack(o.unique(o.merge(this.get(),typeof E==="string"?o(E):o.makeArray(E))))},is:function(E){return !!E&&o.multiFilter(E,this).length>0},hasClass:function(E){return !!E&&this.is("."+E)},val:function(K){if(K===g){var E=this[0];if(E){if(o.nodeName(E,"option")){return(E.attributes.value||{}).specified?E.value:E.text}if(o.nodeName(E,"select")){var I=E.selectedIndex,L=[],M=E.options,H=E.type=="select-one";if(I<0){return null}for(var F=H?I:0,J=H?I+1:M.length;F<J;F++){var G=M[F];if(G.selected){K=o(G).val();if(H){return K}L.push(K)}}return L}return(E.value||"").replace(/\r/g,"")}return g}if(typeof K==="number"){K+=""}return this.each(function(){if(this.nodeType!=1){return}if(o.isArray(K)&&/radio|checkbox/.test(this.type)){this.checked=(o.inArray(this.value,K)>=0||o.inArray(this.name,K)>=0)}else{if(o.nodeName(this,"select")){var N=o.makeArray(K);o("option",this).each(function(){this.selected=(o.inArray(this.value,N)>=0||o.inArray(this.text,N)>=0)});if(!N.length){this.selectedIndex=-1}}else{this.value=K}}})},html:function(E){return E===g?(this[0]?this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g,""):null):this.empty().append(E)},replaceWith:function(E){return this.after(E).remove()},eq:function(E){return this.slice(E,+E+1)},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments),"slice",Array.prototype.slice.call(arguments).join(","))},map:function(E){return this.pushStack(o.map(this,function(G,F){return E.call(G,F,G)}))},andSelf:function(){return this.add(this.prevObject)},domManip:function(J,M,L){if(this[0]){var I=(this[0].ownerDocument||this[0]).createDocumentFragment(),F=o.clean(J,(this[0].ownerDocument||this[0]),I),H=I.firstChild;if(H){for(var G=0,E=this.length;G<E;G++){L.call(K(this[G],H),this.length>1||G>0?I.cloneNode(true):I)}}if(F){o.each(F,z)}}return this;function K(N,O){return M&&o.nodeName(N,"table")&&o.nodeName(O,"tr")?(N.getElementsByTagName("tbody")[0]||N.appendChild(N.ownerDocument.createElement("tbody"))):N}}};o.fn.init.prototype=o.fn;function z(E,F){if(F.src){o.ajax({url:F.src,async:false,dataType:"script"})}else{o.globalEval(F.text||F.textContent||F.innerHTML||"")}if(F.parentNode){F.parentNode.removeChild(F)}}function e(){return +new Date}o.extend=o.fn.extend=function(){var J=arguments[0]||{},H=1,I=arguments.length,E=false,G;if(typeof J==="boolean"){E=J;J=arguments[1]||{};H=2}if(typeof J!=="object"&&!o.isFunction(J)){J={}}if(I==H){J=this;--H}for(;H<I;H++){if((G=arguments[H])!=null){for(var F in G){var K=J[F],L=G[F];if(J===L){continue}if(E&&L&&typeof L==="object"&&!L.nodeType){J[F]=o.extend(E,K||(L.length!=null?[]:{}),L)}else{if(L!==g){J[F]=L}}}}}return J};var b=/z-?index|font-?weight|opacity|zoom|line-?height/i,q=document.defaultView||{},s=Object.prototype.toString;o.extend({noConflict:function(E){l.$=p;if(E){l.jQuery=y}return o},isFunction:function(E){return s.call(E)==="[object Function]"},isArray:function(E){return s.call(E)==="[object Array]"},isXMLDoc:function(E){return E.nodeType===9&&E.documentElement.nodeName!=="HTML"||!!E.ownerDocument&&o.isXMLDoc(E.ownerDocument)},globalEval:function(G){if(G&&/\S/.test(G)){var F=document.getElementsByTagName("head")[0]||document.documentElement,E=document.createElement("script");E.type="text/javascript";if(o.support.scriptEval){E.appendChild(document.createTextNode(G))}else{E.text=G}F.insertBefore(E,F.firstChild);F.removeChild(E)}},nodeName:function(F,E){return F.nodeName&&F.nodeName.toUpperCase()==E.toUpperCase()},each:function(G,K,F){var E,H=0,I=G.length;if(F){if(I===g){for(E in G){if(K.apply(G[E],F)===false){break}}}else{for(;H<I;){if(K.apply(G[H++],F)===false){break}}}}else{if(I===g){for(E in G){if(K.call(G[E],E,G[E])===false){break}}}else{for(var J=G[0];H<I&&K.call(J,H,J)!==false;J=G[++H]){}}}return G},prop:function(H,I,G,F,E){if(o.isFunction(I)){I=I.call(H,F)}return typeof I==="number"&&G=="curCSS"&&!b.test(E)?I+"px":I},className:{add:function(E,F){o.each((F||"").split(/\s+/),function(G,H){if(E.nodeType==1&&!o.className.has(E.className,H)){E.className+=(E.className?" ":"")+H}})},remove:function(E,F){if(E.nodeType==1){E.className=F!==g?o.grep(E.className.split(/\s+/),function(G){return !o.className.has(F,G)}).join(" "):""}},has:function(F,E){return F&&o.inArray(E,(F.className||F).toString().split(/\s+/))>-1}},swap:function(H,G,I){var E={};for(var F in G){E[F]=H.style[F];H.style[F]=G[F]}I.call(H);for(var F in G){H.style[F]=E[F]}},css:function(H,F,J,E){if(F=="width"||F=="height"){var L,G={position:"absolute",visibility:"hidden",display:"block"},K=F=="width"?["Left","Right"]:["Top","Bottom"];function I(){L=F=="width"?H.offsetWidth:H.offsetHeight;if(E==="border"){return}o.each(K,function(){if(!E){L-=parseFloat(o.curCSS(H,"padding"+this,true))||0}if(E==="margin"){L+=parseFloat(o.curCSS(H,"margin"+this,true))||0}else{L-=parseFloat(o.curCSS(H,"border"+this+"Width",true))||0}})}if(H.offsetWidth!==0){I()}else{o.swap(H,G,I)}return Math.max(0,Math.round(L))}return o.curCSS(H,F,J)},curCSS:function(I,F,G){var L,E=I.style;if(F=="opacity"&&!o.support.opacity){L=o.attr(E,"opacity");return L==""?"1":L}if(F.match(/float/i)){F=w}if(!G&&E&&E[F]){L=E[F]}else{if(q.getComputedStyle){if(F.match(/float/i)){F="float"}F=F.replace(/([A-Z])/g,"-$1").toLowerCase();var M=q.getComputedStyle(I,null);if(M){L=M.getPropertyValue(F)}if(F=="opacity"&&L==""){L="1"}}else{if(I.currentStyle){var J=F.replace(/\-(\w)/g,function(N,O){return O.toUpperCase()});L=I.currentStyle[F]||I.currentStyle[J];if(!/^\d+(px)?$/i.test(L)&&/^\d/.test(L)){var H=E.left,K=I.runtimeStyle.left;I.runtimeStyle.left=I.currentStyle.left;E.left=L||0;L=E.pixelLeft+"px";E.left=H;I.runtimeStyle.left=K}}}}return L},clean:function(F,K,I){K=K||document;if(typeof K.createElement==="undefined"){K=K.ownerDocument||K[0]&&K[0].ownerDocument||document}if(!I&&F.length===1&&typeof F[0]==="string"){var H=/^<(\w+)\s*\/?>$/.exec(F[0]);if(H){return[K.createElement(H[1])]}}var G=[],E=[],L=K.createElement("div");o.each(F,function(P,S){if(typeof S==="number"){S+=""}if(!S){return}if(typeof S==="string"){S=S.replace(/(<(\w+)[^>]*?)\/>/g,function(U,V,T){return T.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?U:V+"></"+T+">"});var O=S.replace(/^\s+/,"").substring(0,10).toLowerCase();var Q=!O.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!O.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||O.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!O.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!O.indexOf("<td")||!O.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!O.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||!o.support.htmlSerialize&&[1,"div<div>","</div>"]||[0,"",""];L.innerHTML=Q[1]+S+Q[2];while(Q[0]--){L=L.lastChild}if(!o.support.tbody){var R=/<tbody/i.test(S),N=!O.indexOf("<table")&&!R?L.firstChild&&L.firstChild.childNodes:Q[1]=="<table>"&&!R?L.childNodes:[];for(var M=N.length-1;M>=0;--M){if(o.nodeName(N[M],"tbody")&&!N[M].childNodes.length){N[M].parentNode.removeChild(N[M])}}}if(!o.support.leadingWhitespace&&/^\s/.test(S)){L.insertBefore(K.createTextNode(S.match(/^\s*/)[0]),L.firstChild)}S=o.makeArray(L.childNodes)}if(S.nodeType){G.push(S)}else{G=o.merge(G,S)}});if(I){for(var J=0;G[J];J++){if(o.nodeName(G[J],"script")&&(!G[J].type||G[J].type.toLowerCase()==="text/javascript")){E.push(G[J].parentNode?G[J].parentNode.removeChild(G[J]):G[J])}else{if(G[J].nodeType===1){G.splice.apply(G,[J+1,0].concat(o.makeArray(G[J].getElementsByTagName("script"))))}I.appendChild(G[J])}}return E}return G},attr:function(J,G,K){if(!J||J.nodeType==3||J.nodeType==8){return g}var H=!o.isXMLDoc(J),L=K!==g;G=H&&o.props[G]||G;if(J.tagName){var F=/href|src|style/.test(G);if(G=="selected"&&J.parentNode){J.parentNode.selectedIndex}if(G in J&&H&&!F){if(L){if(G=="type"&&o.nodeName(J,"input")&&J.parentNode){throw"type property can't be changed"}J[G]=K}if(o.nodeName(J,"form")&&J.getAttributeNode(G)){return J.getAttributeNode(G).nodeValue}if(G=="tabIndex"){var I=J.getAttributeNode("tabIndex");return I&&I.specified?I.value:J.nodeName.match(/(button|input|object|select|textarea)/i)?0:J.nodeName.match(/^(a|area)$/i)&&J.href?0:g}return J[G]}if(!o.support.style&&H&&G=="style"){return o.attr(J.style,"cssText",K)}if(L){J.setAttribute(G,""+K)}var E=!o.support.hrefNormalized&&H&&F?J.getAttribute(G,2):J.getAttribute(G);return E===null?g:E}if(!o.support.opacity&&G=="opacity"){if(L){J.zoom=1;J.filter=(J.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(K)+""=="NaN"?"":"alpha(opacity="+K*100+")")}return J.filter&&J.filter.indexOf("opacity=")>=0?(parseFloat(J.filter.match(/opacity=([^)]*)/)[1])/100)+"":""}G=G.replace(/-([a-z])/ig,function(M,N){return N.toUpperCase()});if(L){J[G]=K}return J[G]},trim:function(E){return(E||"").replace(/^\s+|\s+$/g,"")},makeArray:function(G){var E=[];if(G!=null){var F=G.length;if(F==null||typeof G==="string"||o.isFunction(G)||G.setInterval){E[0]=G}else{while(F){E[--F]=G[F]}}}return E},inArray:function(G,H){for(var E=0,F=H.length;E<F;E++){if(H[E]===G){return E}}return -1},merge:function(H,E){var F=0,G,I=H.length;if(!o.support.getAll){while((G=E[F++])!=null){if(G.nodeType!=8){H[I++]=G}}}else{while((G=E[F++])!=null){H[I++]=G}}return H},unique:function(K){var F=[],E={};try{for(var G=0,H=K.length;G<H;G++){var J=o.data(K[G]);if(!E[J]){E[J]=true;F.push(K[G])}}}catch(I){F=K}return F},grep:function(F,J,E){var G=[];for(var H=0,I=F.length;H<I;H++){if(!E!=!J(F[H],H)){G.push(F[H])}}return G},map:function(E,J){var F=[];for(var G=0,H=E.length;G<H;G++){var I=J(E[G],G);if(I!=null){F[F.length]=I}}return F.concat.apply([],F)}});var C=navigator.userAgent.toLowerCase();o.browser={version:(C.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[0,"0"])[1],safari:/webkit/.test(C),opera:/opera/.test(C),msie:/msie/.test(C)&&!/opera/.test(C),mozilla:/mozilla/.test(C)&&!/(compatible|webkit)/.test(C)};o.each({parent:function(E){return E.parentNode},parents:function(E){return o.dir(E,"parentNode")},next:function(E){return o.nth(E,2,"nextSibling")},prev:function(E){return o.nth(E,2,"previousSibling")},nextAll:function(E){return o.dir(E,"nextSibling")},prevAll:function(E){return o.dir(E,"previousSibling")},siblings:function(E){return o.sibling(E.parentNode.firstChild,E)},children:function(E){return o.sibling(E.firstChild)},contents:function(E){return o.nodeName(E,"iframe")?E.contentDocument||E.contentWindow.document:o.makeArray(E.childNodes)}},function(E,F){o.fn[E]=function(G){var H=o.map(this,F);if(G&&typeof G=="string"){H=o.multiFilter(G,H)}return this.pushStack(o.unique(H),E,G)}});o.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(E,F){o.fn[E]=function(G){var J=[],L=o(G);for(var K=0,H=L.length;K<H;K++){var I=(K>0?this.clone(true):this).get();o.fn[F].apply(o(L[K]),I);J=J.concat(I)}return this.pushStack(J,E,G)}});o.each({removeAttr:function(E){o.attr(this,E,"");if(this.nodeType==1){this.removeAttribute(E)}},addClass:function(E){o.className.add(this,E)},removeClass:function(E){o.className.remove(this,E)},toggleClass:function(F,E){if(typeof E!=="boolean"){E=!o.className.has(this,F)}o.className[E?"add":"remove"](this,F)},remove:function(E){if(!E||o.filter(E,[this]).length){o("*",this).add([this]).each(function(){o.event.remove(this);o.removeData(this)});if(this.parentNode){this.parentNode.removeChild(this)}}},empty:function(){o(this).children().remove();while(this.firstChild){this.removeChild(this.firstChild)}}},function(E,F){o.fn[E]=function(){return this.each(F,arguments)}});function j(E,F){return E[0]&&parseInt(o.curCSS(E[0],F,true),10)||0}var h="jQuery"+e(),v=0,A={};o.extend({cache:{},data:function(F,E,G){F=F==l?A:F;var H=F[h];if(!H){H=F[h]=++v}if(E&&!o.cache[H]){o.cache[H]={}}if(G!==g){o.cache[H][E]=G}return E?o.cache[H][E]:H},removeData:function(F,E){F=F==l?A:F;var H=F[h];if(E){if(o.cache[H]){delete o.cache[H][E];E="";for(E in o.cache[H]){break}if(!E){o.removeData(F)}}}else{try{delete F[h]}catch(G){if(F.removeAttribute){F.removeAttribute(h)}}delete o.cache[H]}},queue:function(F,E,H){if(F){E=(E||"fx")+"queue";var G=o.data(F,E);if(!G||o.isArray(H)){G=o.data(F,E,o.makeArray(H))}else{if(H){G.push(H)}}}return G},dequeue:function(H,G){var E=o.queue(H,G),F=E.shift();if(!G||G==="fx"){F=E[0]}if(F!==g){F.call(H)}}});o.fn.extend({data:function(E,G){var H=E.split(".");H[1]=H[1]?"."+H[1]:"";if(G===g){var F=this.triggerHandler("getData"+H[1]+"!",[H[0]]);if(F===g&&this.length){F=o.data(this[0],E)}return F===g&&H[1]?this.data(H[0]):F}else{return this.trigger("setData"+H[1]+"!",[H[0],G]).each(function(){o.data(this,E,G)})}},removeData:function(E){return this.each(function(){o.removeData(this,E)})},queue:function(E,F){if(typeof E!=="string"){F=E;E="fx"}if(F===g){return o.queue(this[0],E)}return this.each(function(){var G=o.queue(this,E,F);if(E=="fx"&&G.length==1){G[0].call(this)}})},dequeue:function(E){return this.each(function(){o.dequeue(this,E)})}});
-/*
- * Sizzle CSS Selector Engine - v0.9.3
- * Copyright 2009, The Dojo Foundation
- * Released under the MIT, BSD, and GPL Licenses.
- * More information: http://sizzlejs.com/
- */
-(function(){var R=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,L=0,H=Object.prototype.toString;var F=function(Y,U,ab,ac){ab=ab||[];U=U||document;if(U.nodeType!==1&&U.nodeType!==9){return[]}if(!Y||typeof Y!=="string"){return ab}var Z=[],W,af,ai,T,ad,V,X=true;R.lastIndex=0;while((W=R.exec(Y))!==null){Z.push(W[1]);if(W[2]){V=RegExp.rightContext;break}}if(Z.length>1&&M.exec(Y)){if(Z.length===2&&I.relative[Z[0]]){af=J(Z[0]+Z[1],U)}else{af=I.relative[Z[0]]?[U]:F(Z.shift(),U);while(Z.length){Y=Z.shift();if(I.relative[Y]){Y+=Z.shift()}af=J(Y,af)}}}else{var ae=ac?{expr:Z.pop(),set:E(ac)}:F.find(Z.pop(),Z.length===1&&U.parentNode?U.parentNode:U,Q(U));af=F.filter(ae.expr,ae.set);if(Z.length>0){ai=E(af)}else{X=false}while(Z.length){var ah=Z.pop(),ag=ah;if(!I.relative[ah]){ah=""}else{ag=Z.pop()}if(ag==null){ag=U}I.relative[ah](ai,ag,Q(U))}}if(!ai){ai=af}if(!ai){throw"Syntax error, unrecognized expression: "+(ah||Y)}if(H.call(ai)==="[object Array]"){if(!X){ab.push.apply(ab,ai)}else{if(U.nodeType===1){for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&(ai[aa]===true||ai[aa].nodeType===1&&K(U,ai[aa]))){ab.push(af[aa])}}}else{for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&ai[aa].nodeType===1){ab.push(af[aa])}}}}}else{E(ai,ab)}if(V){F(V,U,ab,ac);if(G){hasDuplicate=false;ab.sort(G);if(hasDuplicate){for(var aa=1;aa<ab.length;aa++){if(ab[aa]===ab[aa-1]){ab.splice(aa--,1)}}}}}return ab};F.matches=function(T,U){return F(T,null,null,U)};F.find=function(aa,T,ab){var Z,X;if(!aa){return[]}for(var W=0,V=I.order.length;W<V;W++){var Y=I.order[W],X;if((X=I.match[Y].exec(aa))){var U=RegExp.leftContext;if(U.substr(U.length-1)!=="\\"){X[1]=(X[1]||"").replace(/\\/g,"");Z=I.find[Y](X,T,ab);if(Z!=null){aa=aa.replace(I.match[Y],"");break}}}}if(!Z){Z=T.getElementsByTagName("*")}return{set:Z,expr:aa}};F.filter=function(ad,ac,ag,W){var V=ad,ai=[],aa=ac,Y,T,Z=ac&&ac[0]&&Q(ac[0]);while(ad&&ac.length){for(var ab in I.filter){if((Y=I.match[ab].exec(ad))!=null){var U=I.filter[ab],ah,af;T=false;if(aa==ai){ai=[]}if(I.preFilter[ab]){Y=I.preFilter[ab](Y,aa,ag,ai,W,Z);if(!Y){T=ah=true}else{if(Y===true){continue}}}if(Y){for(var X=0;(af=aa[X])!=null;X++){if(af){ah=U(af,Y,X,aa);var ae=W^!!ah;if(ag&&ah!=null){if(ae){T=true}else{aa[X]=false}}else{if(ae){ai.push(af);T=true}}}}}if(ah!==g){if(!ag){aa=ai}ad=ad.replace(I.match[ab],"");if(!T){return[]}break}}}if(ad==V){if(T==null){throw"Syntax error, unrecognized expression: "+ad}else{break}}V=ad}return aa};var I=F.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(T){return T.getAttribute("href")}},relative:{"+":function(aa,T,Z){var X=typeof T==="string",ab=X&&!/\W/.test(T),Y=X&&!ab;if(ab&&!Z){T=T.toUpperCase()}for(var W=0,V=aa.length,U;W<V;W++){if((U=aa[W])){while((U=U.previousSibling)&&U.nodeType!==1){}aa[W]=Y||U&&U.nodeName===T?U||false:U===T}}if(Y){F.filter(T,aa,true)}},">":function(Z,U,aa){var X=typeof U==="string";if(X&&!/\W/.test(U)){U=aa?U:U.toUpperCase();for(var V=0,T=Z.length;V<T;V++){var Y=Z[V];if(Y){var W=Y.parentNode;Z[V]=W.nodeName===U?W:false}}}else{for(var V=0,T=Z.length;V<T;V++){var Y=Z[V];if(Y){Z[V]=X?Y.parentNode:Y.parentNode===U}}if(X){F.filter(U,Z,true)}}},"":function(W,U,Y){var V=L++,T=S;if(!U.match(/\W/)){var X=U=Y?U:U.toUpperCase();T=P}T("parentNode",U,V,W,X,Y)},"~":function(W,U,Y){var V=L++,T=S;if(typeof U==="string"&&!U.match(/\W/)){var X=U=Y?U:U.toUpperCase();T=P}T("previousSibling",U,V,W,X,Y)}},find:{ID:function(U,V,W){if(typeof V.getElementById!=="undefined"&&!W){var T=V.getElementById(U[1]);return T?[T]:[]}},NAME:function(V,Y,Z){if(typeof Y.getElementsByName!=="undefined"){var U=[],X=Y.getElementsByName(V[1]);for(var W=0,T=X.length;W<T;W++){if(X[W].getAttribute("name")===V[1]){U.push(X[W])}}return U.length===0?null:U}},TAG:function(T,U){return U.getElementsByTagName(T[1])}},preFilter:{CLASS:function(W,U,V,T,Z,aa){W=" "+W[1].replace(/\\/g,"")+" ";if(aa){return W}for(var X=0,Y;(Y=U[X])!=null;X++){if(Y){if(Z^(Y.className&&(" "+Y.className+" ").indexOf(W)>=0)){if(!V){T.push(Y)}}else{if(V){U[X]=false}}}}return false},ID:function(T){return T[1].replace(/\\/g,"")},TAG:function(U,T){for(var V=0;T[V]===false;V++){}return T[V]&&Q(T[V])?U[1]:U[1].toUpperCase()},CHILD:function(T){if(T[1]=="nth"){var U=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(T[2]=="even"&&"2n"||T[2]=="odd"&&"2n+1"||!/\D/.test(T[2])&&"0n+"+T[2]||T[2]);T[2]=(U[1]+(U[2]||1))-0;T[3]=U[3]-0}T[0]=L++;return T},ATTR:function(X,U,V,T,Y,Z){var W=X[1].replace(/\\/g,"");if(!Z&&I.attrMap[W]){X[1]=I.attrMap[W]}if(X[2]==="~="){X[4]=" "+X[4]+" "}return X},PSEUDO:function(X,U,V,T,Y){if(X[1]==="not"){if(X[3].match(R).length>1||/^\w/.test(X[3])){X[3]=F(X[3],null,null,U)}else{var W=F.filter(X[3],U,V,true^Y);if(!V){T.push.apply(T,W)}return false}}else{if(I.match.POS.test(X[0])||I.match.CHILD.test(X[0])){return true}}return X},POS:function(T){T.unshift(true);return T}},filters:{enabled:function(T){return T.disabled===false&&T.type!=="hidden"},disabled:function(T){return T.disabled===true},checked:function(T){return T.checked===true},selected:function(T){T.parentNode.selectedIndex;return T.selected===true},parent:function(T){return !!T.firstChild},empty:function(T){return !T.firstChild},has:function(V,U,T){return !!F(T[3],V).length},header:function(T){return/h\d/i.test(T.nodeName)},text:function(T){return"text"===T.type},radio:function(T){return"radio"===T.type},checkbox:function(T){return"checkbox"===T.type},file:function(T){return"file"===T.type},password:function(T){return"password"===T.type},submit:function(T){return"submit"===T.type},image:function(T){return"image"===T.type},reset:function(T){return"reset"===T.type},button:function(T){return"button"===T.type||T.nodeName.toUpperCase()==="BUTTON"},input:function(T){return/input|select|textarea|button/i.test(T.nodeName)}},setFilters:{first:function(U,T){return T===0},last:function(V,U,T,W){return U===W.length-1},even:function(U,T){return T%2===0},odd:function(U,T){return T%2===1},lt:function(V,U,T){return U<T[3]-0},gt:function(V,U,T){return U>T[3]-0},nth:function(V,U,T){return T[3]-0==U},eq:function(V,U,T){return T[3]-0==U}},filter:{PSEUDO:function(Z,V,W,aa){var U=V[1],X=I.filters[U];if(X){return X(Z,W,V,aa)}else{if(U==="contains"){return(Z.textContent||Z.innerText||"").indexOf(V[3])>=0}else{if(U==="not"){var Y=V[3];for(var W=0,T=Y.length;W<T;W++){if(Y[W]===Z){return false}}return true}}}},CHILD:function(T,W){var Z=W[1],U=T;switch(Z){case"only":case"first":while(U=U.previousSibling){if(U.nodeType===1){return false}}if(Z=="first"){return true}U=T;case"last":while(U=U.nextSibling){if(U.nodeType===1){return false}}return true;case"nth":var V=W[2],ac=W[3];if(V==1&&ac==0){return true}var Y=W[0],ab=T.parentNode;if(ab&&(ab.sizcache!==Y||!T.nodeIndex)){var X=0;for(U=ab.firstChild;U;U=U.nextSibling){if(U.nodeType===1){U.nodeIndex=++X}}ab.sizcache=Y}var aa=T.nodeIndex-ac;if(V==0){return aa==0}else{return(aa%V==0&&aa/V>=0)}}},ID:function(U,T){return U.nodeType===1&&U.getAttribute("id")===T},TAG:function(U,T){return(T==="*"&&U.nodeType===1)||U.nodeName===T},CLASS:function(U,T){return(" "+(U.className||U.getAttribute("class"))+" ").indexOf(T)>-1},ATTR:function(Y,W){var V=W[1],T=I.attrHandle[V]?I.attrHandle[V](Y):Y[V]!=null?Y[V]:Y.getAttribute(V),Z=T+"",X=W[2],U=W[4];return T==null?X==="!=":X==="="?Z===U:X==="*="?Z.indexOf(U)>=0:X==="~="?(" "+Z+" ").indexOf(U)>=0:!U?Z&&T!==false:X==="!="?Z!=U:X==="^="?Z.indexOf(U)===0:X==="$="?Z.substr(Z.length-U.length)===U:X==="|="?Z===U||Z.substr(0,U.length+1)===U+"-":false},POS:function(X,U,V,Y){var T=U[2],W=I.setFilters[T];if(W){return W(X,V,U,Y)}}}};var M=I.match.POS;for(var O in I.match){I.match[O]=RegExp(I.match[O].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var E=function(U,T){U=Array.prototype.slice.call(U);if(T){T.push.apply(T,U);return T}return U};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(N){E=function(X,W){var U=W||[];if(H.call(X)==="[object Array]"){Array.prototype.push.apply(U,X)}else{if(typeof X.length==="number"){for(var V=0,T=X.length;V<T;V++){U.push(X[V])}}else{for(var V=0;X[V];V++){U.push(X[V])}}}return U}}var G;if(document.documentElement.compareDocumentPosition){G=function(U,T){var V=U.compareDocumentPosition(T)&4?-1:U===T?0:1;if(V===0){hasDuplicate=true}return V}}else{if("sourceIndex" in document.documentElement){G=function(U,T){var V=U.sourceIndex-T.sourceIndex;if(V===0){hasDuplicate=true}return V}}else{if(document.createRange){G=function(W,U){var V=W.ownerDocument.createRange(),T=U.ownerDocument.createRange();V.selectNode(W);V.collapse(true);T.selectNode(U);T.collapse(true);var X=V.compareBoundaryPoints(Range.START_TO_END,T);if(X===0){hasDuplicate=true}return X}}}}(function(){var U=document.createElement("form"),V="script"+(new Date).getTime();U.innerHTML="<input name='"+V+"'/>";var T=document.documentElement;T.insertBefore(U,T.firstChild);if(!!document.getElementById(V)){I.find.ID=function(X,Y,Z){if(typeof Y.getElementById!=="undefined"&&!Z){var W=Y.getElementById(X[1]);return W?W.id===X[1]||typeof W.getAttributeNode!=="undefined"&&W.getAttributeNode("id").nodeValue===X[1]?[W]:g:[]}};I.filter.ID=function(Y,W){var X=typeof Y.getAttributeNode!=="undefined"&&Y.getAttributeNode("id");return Y.nodeType===1&&X&&X.nodeValue===W}}T.removeChild(U)})();(function(){var T=document.createElement("div");T.appendChild(document.createComment(""));if(T.getElementsByTagName("*").length>0){I.find.TAG=function(U,Y){var X=Y.getElementsByTagName(U[1]);if(U[1]==="*"){var W=[];for(var V=0;X[V];V++){if(X[V].nodeType===1){W.push(X[V])}}X=W}return X}}T.innerHTML="<a href='#'></a>";if(T.firstChild&&typeof T.firstChild.getAttribute!=="undefined"&&T.firstChild.getAttribute("href")!=="#"){I.attrHandle.href=function(U){return U.getAttribute("href",2)}}})();if(document.querySelectorAll){(function(){var T=F,U=document.createElement("div");U.innerHTML="<p class='TEST'></p>";if(U.querySelectorAll&&U.querySelectorAll(".TEST").length===0){return}F=function(Y,X,V,W){X=X||document;if(!W&&X.nodeType===9&&!Q(X)){try{return E(X.querySelectorAll(Y),V)}catch(Z){}}return T(Y,X,V,W)};F.find=T.find;F.filter=T.filter;F.selectors=T.selectors;F.matches=T.matches})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var T=document.createElement("div");T.innerHTML="<div class='test e'></div><div class='test'></div>";if(T.getElementsByClassName("e").length===0){return}T.lastChild.className="e";if(T.getElementsByClassName("e").length===1){return}I.order.splice(1,0,"CLASS");I.find.CLASS=function(U,V,W){if(typeof V.getElementsByClassName!=="undefined"&&!W){return V.getElementsByClassName(U[1])}}})()}function P(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W<V;W++){var T=ad[W];if(T){if(ab&&T.nodeType===1){T.sizcache=Y;T.sizset=W}T=T[U];var X=false;while(T){if(T.sizcache===Y){X=ad[T.sizset];break}if(T.nodeType===1&&!ac){T.sizcache=Y;T.sizset=W}if(T.nodeName===Z){X=T;break}T=T[U]}ad[W]=X}}}function S(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W<V;W++){var T=ad[W];if(T){if(ab&&T.nodeType===1){T.sizcache=Y;T.sizset=W}T=T[U];var X=false;while(T){if(T.sizcache===Y){X=ad[T.sizset];break}if(T.nodeType===1){if(!ac){T.sizcache=Y;T.sizset=W}if(typeof Z!=="string"){if(T===Z){X=true;break}}else{if(F.filter(Z,[T]).length>0){X=T;break}}}T=T[U]}ad[W]=X}}}var K=document.compareDocumentPosition?function(U,T){return U.compareDocumentPosition(T)&16}:function(U,T){return U!==T&&(U.contains?U.contains(T):true)};var Q=function(T){return T.nodeType===9&&T.documentElement.nodeName!=="HTML"||!!T.ownerDocument&&Q(T.ownerDocument)};var J=function(T,aa){var W=[],X="",Y,V=aa.nodeType?[aa]:aa;while((Y=I.match.PSEUDO.exec(T))){X+=Y[0];T=T.replace(I.match.PSEUDO,"")}T=I.relative[T]?T+"*":T;for(var Z=0,U=V.length;Z<U;Z++){F(T,V[Z],W)}return F.filter(X,W)};o.find=F;o.filter=F.filter;o.expr=F.selectors;o.expr[":"]=o.expr.filters;F.selectors.filters.hidden=function(T){return T.offsetWidth===0||T.offsetHeight===0};F.selectors.filters.visible=function(T){return T.offsetWidth>0||T.offsetHeight>0};F.selectors.filters.animated=function(T){return o.grep(o.timers,function(U){return T===U.elem}).length};o.multiFilter=function(V,T,U){if(U){V=":not("+V+")"}return F.matches(V,T)};o.dir=function(V,U){var T=[],W=V[U];while(W&&W!=document){if(W.nodeType==1){T.push(W)}W=W[U]}return T};o.nth=function(X,T,V,W){T=T||1;var U=0;for(;X;X=X[V]){if(X.nodeType==1&&++U==T){break}}return X};o.sibling=function(V,U){var T=[];for(;V;V=V.nextSibling){if(V.nodeType==1&&V!=U){T.push(V)}}return T};return;l.Sizzle=F})();o.event={add:function(I,F,H,K){if(I.nodeType==3||I.nodeType==8){return}if(I.setInterval&&I!=l){I=l}if(!H.guid){H.guid=this.guid++}if(K!==g){var G=H;H=this.proxy(G);H.data=K}var E=o.data(I,"events")||o.data(I,"events",{}),J=o.data(I,"handle")||o.data(I,"handle",function(){return typeof o!=="undefined"&&!o.event.triggered?o.event.handle.apply(arguments.callee.elem,arguments):g});J.elem=I;o.each(F.split(/\s+/),function(M,N){var O=N.split(".");N=O.shift();H.type=O.slice().sort().join(".");var L=E[N];if(o.event.specialAll[N]){o.event.specialAll[N].setup.call(I,K,O)}if(!L){L=E[N]={};if(!o.event.special[N]||o.event.special[N].setup.call(I,K,O)===false){if(I.addEventListener){I.addEventListener(N,J,false)}else{if(I.attachEvent){I.attachEvent("on"+N,J)}}}}L[H.guid]=H;o.event.global[N]=true});I=null},guid:1,global:{},remove:function(K,H,J){if(K.nodeType==3||K.nodeType==8){return}var G=o.data(K,"events"),F,E;if(G){if(H===g||(typeof H==="string"&&H.charAt(0)==".")){for(var I in G){this.remove(K,I+(H||""))}}else{if(H.type){J=H.handler;H=H.type}o.each(H.split(/\s+/),function(M,O){var Q=O.split(".");O=Q.shift();var N=RegExp("(^|\\.)"+Q.slice().sort().join(".*\\.")+"(\\.|$)");if(G[O]){if(J){delete G[O][J.guid]}else{for(var P in G[O]){if(N.test(G[O][P].type)){delete G[O][P]}}}if(o.event.specialAll[O]){o.event.specialAll[O].teardown.call(K,Q)}for(F in G[O]){break}if(!F){if(!o.event.special[O]||o.event.special[O].teardown.call(K,Q)===false){if(K.removeEventListener){K.removeEventListener(O,o.data(K,"handle"),false)}else{if(K.detachEvent){K.detachEvent("on"+O,o.data(K,"handle"))}}}F=null;delete G[O]}}})}for(F in G){break}if(!F){var L=o.data(K,"handle");if(L){L.elem=null}o.removeData(K,"events");o.removeData(K,"handle")}}},trigger:function(I,K,H,E){var G=I.type||I;if(!E){I=typeof I==="object"?I[h]?I:o.extend(o.Event(G),I):o.Event(G);if(G.indexOf("!")>=0){I.type=G=G.slice(0,-1);I.exclusive=true}if(!H){I.stopPropagation();if(this.global[G]){o.each(o.cache,function(){if(this.events&&this.events[G]){o.event.trigger(I,K,this.handle.elem)}})}}if(!H||H.nodeType==3||H.nodeType==8){return g}I.result=g;I.target=H;K=o.makeArray(K);K.unshift(I)}I.currentTarget=H;var J=o.data(H,"handle");if(J){J.apply(H,K)}if((!H[G]||(o.nodeName(H,"a")&&G=="click"))&&H["on"+G]&&H["on"+G].apply(H,K)===false){I.result=false}if(!E&&H[G]&&!I.isDefaultPrevented()&&!(o.nodeName(H,"a")&&G=="click")){this.triggered=true;try{H[G]()}catch(L){}}this.triggered=false;if(!I.isPropagationStopped()){var F=H.parentNode||H.ownerDocument;if(F){o.event.trigger(I,K,F,true)}}},handle:function(K){var J,E;K=arguments[0]=o.event.fix(K||l.event);K.currentTarget=this;var L=K.type.split(".");K.type=L.shift();J=!L.length&&!K.exclusive;var I=RegExp("(^|\\.)"+L.slice().sort().join(".*\\.")+"(\\.|$)");E=(o.data(this,"events")||{})[K.type];for(var G in E){var H=E[G];if(J||I.test(H.type)){K.handler=H;K.data=H.data;var F=H.apply(this,arguments);if(F!==g){K.result=F;if(F===false){K.preventDefault();K.stopPropagation()}}if(K.isImmediatePropagationStopped()){break}}}},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(H){if(H[h]){return H}var F=H;H=o.Event(F);for(var G=this.props.length,J;G;){J=this.props[--G];H[J]=F[J]}if(!H.target){H.target=H.srcElement||document}if(H.target.nodeType==3){H.target=H.target.parentNode}if(!H.relatedTarget&&H.fromElement){H.relatedTarget=H.fromElement==H.target?H.toElement:H.fromElement}if(H.pageX==null&&H.clientX!=null){var I=document.documentElement,E=document.body;H.pageX=H.clientX+(I&&I.scrollLeft||E&&E.scrollLeft||0)-(I.clientLeft||0);H.pageY=H.clientY+(I&&I.scrollTop||E&&E.scrollTop||0)-(I.clientTop||0)}if(!H.which&&((H.charCode||H.charCode===0)?H.charCode:H.keyCode)){H.which=H.charCode||H.keyCode}if(!H.metaKey&&H.ctrlKey){H.metaKey=H.ctrlKey}if(!H.which&&H.button){H.which=(H.button&1?1:(H.button&2?3:(H.button&4?2:0)))}return H},proxy:function(F,E){E=E||function(){return F.apply(this,arguments)};E.guid=F.guid=F.guid||E.guid||this.guid++;return E},special:{ready:{setup:B,teardown:function(){}}},specialAll:{live:{setup:function(E,F){o.event.add(this,F[0],c)},teardown:function(G){if(G.length){var E=0,F=RegExp("(^|\\.)"+G[0]+"(\\.|$)");o.each((o.data(this,"events").live||{}),function(){if(F.test(this.type)){E++}});if(E<1){o.event.remove(this,G[0],c)}}}}}};o.Event=function(E){if(!this.preventDefault){return new o.Event(E)}if(E&&E.type){this.originalEvent=E;this.type=E.type}else{this.type=E}this.timeStamp=e();this[h]=true};function k(){return false}function u(){return true}o.Event.prototype={preventDefault:function(){this.isDefaultPrevented=u;var E=this.originalEvent;if(!E){return}if(E.preventDefault){E.preventDefault()}E.returnValue=false},stopPropagation:function(){this.isPropagationStopped=u;var E=this.originalEvent;if(!E){return}if(E.stopPropagation){E.stopPropagation()}E.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=u;this.stopPropagation()},isDefaultPrevented:k,isPropagationStopped:k,isImmediatePropagationStopped:k};var a=function(F){var E=F.relatedTarget;while(E&&E!=this){try{E=E.parentNode}catch(G){E=this}}if(E!=this){F.type=F.data;o.event.handle.apply(this,arguments)}};o.each({mouseover:"mouseenter",mouseout:"mouseleave"},function(F,E){o.event.special[E]={setup:function(){o.event.add(this,F,a,E)},teardown:function(){o.event.remove(this,F,a)}}});o.fn.extend({bind:function(F,G,E){return F=="unload"?this.one(F,G,E):this.each(function(){o.event.add(this,F,E||G,E&&G)})},one:function(G,H,F){var E=o.event.proxy(F||H,function(I){o(this).unbind(I,E);return(F||H).apply(this,arguments)});return this.each(function(){o.event.add(this,G,E,F&&H)})},unbind:function(F,E){return this.each(function(){o.event.remove(this,F,E)})},trigger:function(E,F){return this.each(function(){o.event.trigger(E,F,this)})},triggerHandler:function(E,G){if(this[0]){var F=o.Event(E);F.preventDefault();F.stopPropagation();o.event.trigger(F,G,this[0]);return F.result}},toggle:function(G){var E=arguments,F=1;while(F<E.length){o.event.proxy(G,E[F++])}return this.click(o.event.proxy(G,function(H){this.lastToggle=(this.lastToggle||0)%F;H.preventDefault();return E[this.lastToggle++].apply(this,arguments)||false}))},hover:function(E,F){return this.mouseenter(E).mouseleave(F)},ready:function(E){B();if(o.isReady){E.call(document,o)}else{o.readyList.push(E)}return this},live:function(G,F){var E=o.event.proxy(F);E.guid+=this.selector+G;o(document).bind(i(G,this.selector),this.selector,E);return this},die:function(F,E){o(document).unbind(i(F,this.selector),E?{guid:E.guid+this.selector+F}:null);return this}});function c(H){var E=RegExp("(^|\\.)"+H.type+"(\\.|$)"),G=true,F=[];o.each(o.data(this,"events").live||[],function(I,J){if(E.test(J.type)){var K=o(H.target).closest(J.data)[0];if(K){F.push({elem:K,fn:J})}}});F.sort(function(J,I){return o.data(J.elem,"closest")-o.data(I.elem,"closest")});o.each(F,function(){if(this.fn.call(this.elem,H,this.fn.data)===false){return(G=false)}});return G}function i(F,E){return["live",F,E.replace(/\./g,"`").replace(/ /g,"|")].join(".")}o.extend({isReady:false,readyList:[],ready:function(){if(!o.isReady){o.isReady=true;if(o.readyList){o.each(o.readyList,function(){this.call(document,o)});o.readyList=null}o(document).triggerHandler("ready")}}});var x=false;function B(){if(x){return}x=true;if(document.addEventListener){document.addEventListener("DOMContentLoaded",function(){document.removeEventListener("DOMContentLoaded",arguments.callee,false);o.ready()},false)}else{if(document.attachEvent){document.attachEvent("onreadystatechange",function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",arguments.callee);o.ready()}});if(document.documentElement.doScroll&&l==l.top){(function(){if(o.isReady){return}try{document.documentElement.doScroll("left")}catch(E){setTimeout(arguments.callee,0);return}o.ready()})()}}}o.event.add(l,"load",o.ready)}o.each(("blur,focus,load,resize,scroll,unload,click,dblclick,mousedown,mouseup,mousemove,mouseover,mouseout,mouseenter,mouseleave,change,select,submit,keydown,keypress,keyup,error").split(","),function(F,E){o.fn[E]=function(G){return G?this.bind(E,G):this.trigger(E)}});o(l).bind("unload",function(){for(var E in o.cache){if(E!=1&&o.cache[E].handle){o.event.remove(o.cache[E].handle.elem)}}});(function(){o.support={};var F=document.documentElement,G=document.createElement("script"),K=document.createElement("div"),J="script"+(new Date).getTime();K.style.display="none";K.innerHTML=' <link/><table></table><a href="/a" style="color:red;float:left;opacity:.5;">a</a><select><option>text</option></select><object><param/></object>';var H=K.getElementsByTagName("*"),E=K.getElementsByTagName("a")[0];if(!H||!H.length||!E){return}o.support={leadingWhitespace:K.firstChild.nodeType==3,tbody:!K.getElementsByTagName("tbody").length,objectAll:!!K.getElementsByTagName("object")[0].getElementsByTagName("*").length,htmlSerialize:!!K.getElementsByTagName("link").length,style:/red/.test(E.getAttribute("style")),hrefNormalized:E.getAttribute("href")==="/a",opacity:E.style.opacity==="0.5",cssFloat:!!E.style.cssFloat,scriptEval:false,noCloneEvent:true,boxModel:null};G.type="text/javascript";try{G.appendChild(document.createTextNode("window."+J+"=1;"))}catch(I){}F.insertBefore(G,F.firstChild);if(l[J]){o.support.scriptEval=true;delete l[J]}F.removeChild(G);if(K.attachEvent&&K.fireEvent){K.attachEvent("onclick",function(){o.support.noCloneEvent=false;K.detachEvent("onclick",arguments.callee)});K.cloneNode(true).fireEvent("onclick")}o(function(){var L=document.createElement("div");L.style.width=L.style.paddingLeft="1px";document.body.appendChild(L);o.boxModel=o.support.boxModel=L.offsetWidth===2;document.body.removeChild(L).style.display="none"})})();var w=o.support.cssFloat?"cssFloat":"styleFloat";o.props={"for":"htmlFor","class":"className","float":w,cssFloat:w,styleFloat:w,readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",tabindex:"tabIndex"};o.fn.extend({_load:o.fn.load,load:function(G,J,K){if(typeof G!=="string"){return this._load(G)}var I=G.indexOf(" ");if(I>=0){var E=G.slice(I,G.length);G=G.slice(0,I)}var H="GET";if(J){if(o.isFunction(J)){K=J;J=null}else{if(typeof J==="object"){J=o.param(J);H="POST"}}}var F=this;o.ajax({url:G,type:H,dataType:"html",data:J,complete:function(M,L){if(L=="success"||L=="notmodified"){F.html(E?o("<div/>").append(M.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(E):M.responseText)}if(K){F.each(K,[M.responseText,L,M])}}});return this},serialize:function(){return o.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?o.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password|search/i.test(this.type))}).map(function(E,F){var G=o(this).val();return G==null?null:o.isArray(G)?o.map(G,function(I,H){return{name:F.name,value:I}}):{name:F.name,value:G}}).get()}});o.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(E,F){o.fn[F]=function(G){return this.bind(F,G)}});var r=e();o.extend({get:function(E,G,H,F){if(o.isFunction(G)){H=G;G=null}return o.ajax({type:"GET",url:E,data:G,success:H,dataType:F})},getScript:function(E,F){return o.get(E,null,F,"script")},getJSON:function(E,F,G){return o.get(E,F,G,"json")},post:function(E,G,H,F){if(o.isFunction(G)){H=G;G={}}return o.ajax({type:"POST",url:E,data:G,success:H,dataType:F})},ajaxSetup:function(E){o.extend(o.ajaxSettings,E)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return l.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest()},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(M){M=o.extend(true,M,o.extend(true,{},o.ajaxSettings,M));var W,F=/=\?(&|$)/g,R,V,G=M.type.toUpperCase();if(M.data&&M.processData&&typeof M.data!=="string"){M.data=o.param(M.data)}if(M.dataType=="jsonp"){if(G=="GET"){if(!M.url.match(F)){M.url+=(M.url.match(/\?/)?"&":"?")+(M.jsonp||"callback")+"=?"}}else{if(!M.data||!M.data.match(F)){M.data=(M.data?M.data+"&":"")+(M.jsonp||"callback")+"=?"}}M.dataType="json"}if(M.dataType=="json"&&(M.data&&M.data.match(F)||M.url.match(F))){W="jsonp"+r++;if(M.data){M.data=(M.data+"").replace(F,"="+W+"$1")}M.url=M.url.replace(F,"="+W+"$1");M.dataType="script";l[W]=function(X){V=X;I();L();l[W]=g;try{delete l[W]}catch(Y){}if(H){H.removeChild(T)}}}if(M.dataType=="script"&&M.cache==null){M.cache=false}if(M.cache===false&&G=="GET"){var E=e();var U=M.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+E+"$2");M.url=U+((U==M.url)?(M.url.match(/\?/)?"&":"?")+"_="+E:"")}if(M.data&&G=="GET"){M.url+=(M.url.match(/\?/)?"&":"?")+M.data;M.data=null}if(M.global&&!o.active++){o.event.trigger("ajaxStart")}var Q=/^(\w+:)?\/\/([^\/?#]+)/.exec(M.url);if(M.dataType=="script"&&G=="GET"&&Q&&(Q[1]&&Q[1]!=location.protocol||Q[2]!=location.host)){var H=document.getElementsByTagName("head")[0];var T=document.createElement("script");T.src=M.url;if(M.scriptCharset){T.charset=M.scriptCharset}if(!W){var O=false;T.onload=T.onreadystatechange=function(){if(!O&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){O=true;I();L();T.onload=T.onreadystatechange=null;H.removeChild(T)}}}H.appendChild(T);return g}var K=false;var J=M.xhr();if(M.username){J.open(G,M.url,M.async,M.username,M.password)}else{J.open(G,M.url,M.async)}try{if(M.data){J.setRequestHeader("Content-Type",M.contentType)}if(M.ifModified){J.setRequestHeader("If-Modified-Since",o.lastModified[M.url]||"Thu, 01 Jan 1970 00:00:00 GMT")}J.setRequestHeader("X-Requested-With","XMLHttpRequest");J.setRequestHeader("Accept",M.dataType&&M.accepts[M.dataType]?M.accepts[M.dataType]+", */*":M.accepts._default)}catch(S){}if(M.beforeSend&&M.beforeSend(J,M)===false){if(M.global&&!--o.active){o.event.trigger("ajaxStop")}J.abort();return false}if(M.global){o.event.trigger("ajaxSend",[J,M])}var N=function(X){if(J.readyState==0){if(P){clearInterval(P);P=null;if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}}else{if(!K&&J&&(J.readyState==4||X=="timeout")){K=true;if(P){clearInterval(P);P=null}R=X=="timeout"?"timeout":!o.httpSuccess(J)?"error":M.ifModified&&o.httpNotModified(J,M.url)?"notmodified":"success";if(R=="success"){try{V=o.httpData(J,M.dataType,M)}catch(Z){R="parsererror"}}if(R=="success"){var Y;try{Y=J.getResponseHeader("Last-Modified")}catch(Z){}if(M.ifModified&&Y){o.lastModified[M.url]=Y}if(!W){I()}}else{o.handleError(M,J,R)}L();if(X){J.abort()}if(M.async){J=null}}}};if(M.async){var P=setInterval(N,13);if(M.timeout>0){setTimeout(function(){if(J&&!K){N("timeout")}},M.timeout)}}try{J.send(M.data)}catch(S){o.handleError(M,J,null,S)}if(!M.async){N()}function I(){if(M.success){M.success(V,R)}if(M.global){o.event.trigger("ajaxSuccess",[J,M])}}function L(){if(M.complete){M.complete(J,R)}if(M.global){o.event.trigger("ajaxComplete",[J,M])}if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}return J},handleError:function(F,H,E,G){if(F.error){F.error(H,E,G)}if(F.global){o.event.trigger("ajaxError",[H,F,G])}},active:0,httpSuccess:function(F){try{return !F.status&&location.protocol=="file:"||(F.status>=200&&F.status<300)||F.status==304||F.status==1223}catch(E){}return false},httpNotModified:function(G,E){try{var H=G.getResponseHeader("Last-Modified");return G.status==304||H==o.lastModified[E]}catch(F){}return false},httpData:function(J,H,G){var F=J.getResponseHeader("content-type"),E=H=="xml"||!H&&F&&F.indexOf("xml")>=0,I=E?J.responseXML:J.responseText;if(E&&I.documentElement.tagName=="parsererror"){throw"parsererror"}if(G&&G.dataFilter){I=G.dataFilter(I,H)}if(typeof I==="string"){if(H=="script"){o.globalEval(I)}if(H=="json"){I=l["eval"]("("+I+")")}}return I},param:function(E){var G=[];function H(I,J){G[G.length]=encodeURIComponent(I)+"="+encodeURIComponent(J)}if(o.isArray(E)||E.jquery){o.each(E,function(){H(this.name,this.value)})}else{for(var F in E){if(o.isArray(E[F])){o.each(E[F],function(){H(F,this)})}else{H(F,o.isFunction(E[F])?E[F]():E[F])}}}return G.join("&").replace(/%20/g,"+")}});var m={},n,d=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];function t(F,E){var G={};o.each(d.concat.apply([],d.slice(0,E)),function(){G[this]=F});return G}o.fn.extend({show:function(J,L){if(J){return this.animate(t("show",3),J,L)}else{for(var H=0,F=this.length;H<F;H++){var E=o.data(this[H],"olddisplay");this[H].style.display=E||"";if(o.css(this[H],"display")==="none"){var G=this[H].tagName,K;if(m[G]){K=m[G]}else{var I=o("<"+G+" />").appendTo("body");K=I.css("display");if(K==="none"){K="block"}I.remove();m[G]=K}o.data(this[H],"olddisplay",K)}}for(var H=0,F=this.length;H<F;H++){this[H].style.display=o.data(this[H],"olddisplay")||""}return this}},hide:function(H,I){if(H){return this.animate(t("hide",3),H,I)}else{for(var G=0,F=this.length;G<F;G++){var E=o.data(this[G],"olddisplay");if(!E&&E!=="none"){o.data(this[G],"olddisplay",o.css(this[G],"display"))}}for(var G=0,F=this.length;G<F;G++){this[G].style.display="none"}return this}},_toggle:o.fn.toggle,toggle:function(G,F){var E=typeof G==="boolean";return o.isFunction(G)&&o.isFunction(F)?this._toggle.apply(this,arguments):G==null||E?this.each(function(){var H=E?G:o(this).is(":hidden");o(this)[H?"show":"hide"]()}):this.animate(t("toggle",3),G,F)},fadeTo:function(E,G,F){return this.animate({opacity:G},E,F)},animate:function(I,F,H,G){var E=o.speed(F,H,G);return this[E.queue===false?"each":"queue"](function(){var K=o.extend({},E),M,L=this.nodeType==1&&o(this).is(":hidden"),J=this;for(M in I){if(I[M]=="hide"&&L||I[M]=="show"&&!L){return K.complete.call(this)}if((M=="height"||M=="width")&&this.style){K.display=o.css(this,"display");K.overflow=this.style.overflow}}if(K.overflow!=null){this.style.overflow="hidden"}K.curAnim=o.extend({},I);o.each(I,function(O,S){var R=new o.fx(J,K,O);if(/toggle|show|hide/.test(S)){R[S=="toggle"?L?"show":"hide":S](I)}else{var Q=S.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),T=R.cur(true)||0;if(Q){var N=parseFloat(Q[2]),P=Q[3]||"px";if(P!="px"){J.style[O]=(N||1)+P;T=((N||1)/R.cur(true))*T;J.style[O]=T+P}if(Q[1]){N=((Q[1]=="-="?-1:1)*N)+T}R.custom(T,N,P)}else{R.custom(T,S,"")}}});return true})},stop:function(F,E){var G=o.timers;if(F){this.queue([])}this.each(function(){for(var H=G.length-1;H>=0;H--){if(G[H].elem==this){if(E){G[H](true)}G.splice(H,1)}}});if(!E){this.dequeue()}return this}});o.each({slideDown:t("show",1),slideUp:t("hide",1),slideToggle:t("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(E,F){o.fn[E]=function(G,H){return this.animate(F,G,H)}});o.extend({speed:function(G,H,F){var E=typeof G==="object"?G:{complete:F||!F&&H||o.isFunction(G)&&G,duration:G,easing:F&&H||H&&!o.isFunction(H)&&H};E.duration=o.fx.off?0:typeof E.duration==="number"?E.duration:o.fx.speeds[E.duration]||o.fx.speeds._default;E.old=E.complete;E.complete=function(){if(E.queue!==false){o(this).dequeue()}if(o.isFunction(E.old)){E.old.call(this)}};return E},easing:{linear:function(G,H,E,F){return E+F*G},swing:function(G,H,E,F){return((-Math.cos(G*Math.PI)/2)+0.5)*F+E}},timers:[],fx:function(F,E,G){this.options=E;this.elem=F;this.prop=G;if(!E.orig){E.orig={}}}});o.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(o.fx.step[this.prop]||o.fx.step._default)(this);if((this.prop=="height"||this.prop=="width")&&this.elem.style){this.elem.style.display="block"}},cur:function(F){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var E=parseFloat(o.css(this.elem,this.prop,F));return E&&E>-10000?E:parseFloat(o.curCSS(this.elem,this.prop))||0},custom:function(I,H,G){this.startTime=e();this.start=I;this.end=H;this.unit=G||this.unit||"px";this.now=this.start;this.pos=this.state=0;var E=this;function F(J){return E.step(J)}F.elem=this.elem;if(F()&&o.timers.push(F)&&!n){n=setInterval(function(){var K=o.timers;for(var J=0;J<K.length;J++){if(!K[J]()){K.splice(J--,1)}}if(!K.length){clearInterval(n);n=g}},13)}},show:function(){this.options.orig[this.prop]=o.attr(this.elem.style,this.prop);this.options.show=true;this.custom(this.prop=="width"||this.prop=="height"?1:0,this.cur());o(this.elem).show()},hide:function(){this.options.orig[this.prop]=o.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(H){var G=e();if(H||G>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var E=true;for(var F in this.options.curAnim){if(this.options.curAnim[F]!==true){E=false}}if(E){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(o.css(this.elem,"display")=="none"){this.elem.style.display="block"}}if(this.options.hide){o(this.elem).hide()}if(this.options.hide||this.options.show){for(var I in this.options.curAnim){o.attr(this.elem.style,I,this.options.orig[I])}}this.options.complete.call(this.elem)}return false}else{var J=G-this.startTime;this.state=J/this.options.duration;this.pos=o.easing[this.options.easing||(o.easing.swing?"swing":"linear")](this.state,J,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update()}return true}};o.extend(o.fx,{speeds:{slow:600,fast:200,_default:400},step:{opacity:function(E){o.attr(E.elem.style,"opacity",E.now)},_default:function(E){if(E.elem.style&&E.elem.style[E.prop]!=null){E.elem.style[E.prop]=E.now+E.unit}else{E.elem[E.prop]=E.now}}}});if(document.documentElement.getBoundingClientRect){o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}var G=this[0].getBoundingClientRect(),J=this[0].ownerDocument,F=J.body,E=J.documentElement,L=E.clientTop||F.clientTop||0,K=E.clientLeft||F.clientLeft||0,I=G.top+(self.pageYOffset||o.boxModel&&E.scrollTop||F.scrollTop)-L,H=G.left+(self.pageXOffset||o.boxModel&&E.scrollLeft||F.scrollLeft)-K;return{top:I,left:H}}}else{o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}o.offset.initialized||o.offset.initialize();var J=this[0],G=J.offsetParent,F=J,O=J.ownerDocument,M,H=O.documentElement,K=O.body,L=O.defaultView,E=L.getComputedStyle(J,null),N=J.offsetTop,I=J.offsetLeft;while((J=J.parentNode)&&J!==K&&J!==H){M=L.getComputedStyle(J,null);N-=J.scrollTop,I-=J.scrollLeft;if(J===G){N+=J.offsetTop,I+=J.offsetLeft;if(o.offset.doesNotAddBorder&&!(o.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(J.tagName))){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}F=G,G=J.offsetParent}if(o.offset.subtractsBorderForOverflowNotVisible&&M.overflow!=="visible"){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}E=M}if(E.position==="relative"||E.position==="static"){N+=K.offsetTop,I+=K.offsetLeft}if(E.position==="fixed"){N+=Math.max(H.scrollTop,K.scrollTop),I+=Math.max(H.scrollLeft,K.scrollLeft)}return{top:N,left:I}}}o.offset={initialize:function(){if(this.initialized){return}var L=document.body,F=document.createElement("div"),H,G,N,I,M,E,J=L.style.marginTop,K='<div style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;"><div></div></div><table style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;" cellpadding="0" cellspacing="0"><tr><td></td></tr></table>';M={position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"};for(E in M){F.style[E]=M[E]}F.innerHTML=K;L.insertBefore(F,L.firstChild);H=F.firstChild,G=H.firstChild,I=H.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(G.offsetTop!==5);this.doesAddBorderForTableAndCells=(I.offsetTop===5);H.style.overflow="hidden",H.style.position="relative";this.subtractsBorderForOverflowNotVisible=(G.offsetTop===-5);L.style.marginTop="1px";this.doesNotIncludeMarginInBodyOffset=(L.offsetTop===0);L.style.marginTop=J;L.removeChild(F);this.initialized=true},bodyOffset:function(E){o.offset.initialized||o.offset.initialize();var G=E.offsetTop,F=E.offsetLeft;if(o.offset.doesNotIncludeMarginInBodyOffset){G+=parseInt(o.curCSS(E,"marginTop",true),10)||0,F+=parseInt(o.curCSS(E,"marginLeft",true),10)||0}return{top:G,left:F}}};o.fn.extend({position:function(){var I=0,H=0,F;if(this[0]){var G=this.offsetParent(),J=this.offset(),E=/^body|html$/i.test(G[0].tagName)?{top:0,left:0}:G.offset();J.top-=j(this,"marginTop");J.left-=j(this,"marginLeft");E.top+=j(G,"borderTopWidth");E.left+=j(G,"borderLeftWidth");F={top:J.top-E.top,left:J.left-E.left}}return F},offsetParent:function(){var E=this[0].offsetParent||document.body;while(E&&(!/^body|html$/i.test(E.tagName)&&o.css(E,"position")=="static")){E=E.offsetParent}return o(E)}});o.each(["Left","Top"],function(F,E){var G="scroll"+E;o.fn[G]=function(H){if(!this[0]){return null}return H!==g?this.each(function(){this==l||this==document?l.scrollTo(!F?H:o(l).scrollLeft(),F?H:o(l).scrollTop()):this[G]=H}):this[0]==l||this[0]==document?self[F?"pageYOffset":"pageXOffset"]||o.boxModel&&document.documentElement[G]||document.body[G]:this[0][G]}});o.each(["Height","Width"],function(I,G){var E=I?"Left":"Top",H=I?"Right":"Bottom",F=G.toLowerCase();o.fn["inner"+G]=function(){return this[0]?o.css(this[0],F,false,"padding"):null};o.fn["outer"+G]=function(K){return this[0]?o.css(this[0],F,false,K?"margin":"border"):null};var J=G.toLowerCase();o.fn[J]=function(K){return this[0]==l?document.compatMode=="CSS1Compat"&&document.documentElement["client"+G]||document.body["client"+G]:this[0]==document?Math.max(document.documentElement["client"+G],document.body["scroll"+G],document.documentElement["scroll"+G],document.body["offset"+G],document.documentElement["offset"+G]):K===g?(this.length?o.css(this[0],J):null):this.css(J,typeof K==="string"?K:K+"px")}})})();
\ No newline at end of file
deleted file mode 100644
--- a/mail/test/resources/mozmill/mozmill/extension/content/jquery/jquery-ui-1.7.1.custom.min.js
+++ /dev/null
@@ -1,273 +0,0 @@
-/*
- * jQuery UI 1.7.1
- *
- * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT (MIT-LICENSE.txt)
- * and GPL (GPL-LICENSE.txt) licenses.
- *
- * http://docs.jquery.com/UI
- */
jQuery.ui||(function(c){var i=c.fn.remove,d=c.browser.mozilla&&(parseFloat(c.browser.version)<1.9);c.ui={version:"1.7.1",plugin:{add:function(k,l,n){var m=c.ui[k].prototype;for(var j in n){m.plugins[j]=m.plugins[j]||[];m.plugins[j].push([l,n[j]])}},call:function(j,l,k){var n=j.plugins[l];if(!n||!j.element[0].parentNode){return}for(var m=0;m<n.length;m++){if(j.options[n[m][0]]){n[m][1].apply(j.element,k)}}}},contains:function(k,j){return document.compareDocumentPosition?k.compareDocumentPosition(j)&16:k!==j&&k.contains(j)},hasScroll:function(m,k){if(c(m).css("overflow")=="hidden"){return false}var j=(k&&k=="left")?"scrollLeft":"scrollTop",l=false;if(m[j]>0){return true}m[j]=1;l=(m[j]>0);m[j]=0;return l},isOverAxis:function(k,j,l){return(k>j)&&(k<(j+l))},isOver:function(o,k,n,m,j,l){return c.ui.isOverAxis(o,n,j)&&c.ui.isOverAxis(k,m,l)},keyCode:{BACKSPACE:8,CAPS_LOCK:20,COMMA:188,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38}};if(d){var f=c.attr,e=c.fn.removeAttr,h="http://www.w3.org/2005/07/aaa",a=/^aria-/,b=/^wairole:/;c.attr=function(k,j,l){var m=l!==undefined;return(j=="role"?(m?f.call(this,k,j,"wairole:"+l):(f.apply(this,arguments)||"").replace(b,"")):(a.test(j)?(m?k.setAttributeNS(h,j.replace(a,"aaa:"),l):f.call(this,k,j.replace(a,"aaa:"))):f.apply(this,arguments)))};c.fn.removeAttr=function(j){return(a.test(j)?this.each(function(){this.removeAttributeNS(h,j.replace(a,""))}):e.call(this,j))}}c.fn.extend({remove:function(){c("*",this).add(this).each(function(){c(this).triggerHandler("remove")});return i.apply(this,arguments)},enableSelection:function(){return this.attr("unselectable","off").css("MozUserSelect","").unbind("selectstart.ui")},disableSelection:function(){return this.attr("unselectable","on").css("MozUserSelect","none").bind("selectstart.ui",function(){return false})},scrollParent:function(){var j;if((c.browser.msie&&(/(static|relative)/).test(this.css("position")))||(/absolute/).test(this.css("position"))){j=this.parents().filter(function(){return(/(relative|absolute|fixed)/).test(c.curCSS(this,"position",1))&&(/(auto|scroll)/).test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0)}else{j=this.parents().filter(function(){return(/(auto|scroll)/).test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0)}return(/fixed/).test(this.css("position"))||!j.length?c(document):j}});c.extend(c.expr[":"],{data:function(l,k,j){return !!c.data(l,j[3])},focusable:function(k){var l=k.nodeName.toLowerCase(),j=c.attr(k,"tabindex");return(/input|select|textarea|button|object/.test(l)?!k.disabled:"a"==l||"area"==l?k.href||!isNaN(j):!isNaN(j))&&!c(k)["area"==l?"parents":"closest"](":hidden").length},tabbable:function(k){var j=c.attr(k,"tabindex");return(isNaN(j)||j>=0)&&c(k).is(":focusable")}});function g(m,n,o,l){function k(q){var p=c[m][n][q]||[];return(typeof p=="string"?p.split(/,?\s+/):p)}var j=k("getter");if(l.length==1&&typeof l[0]=="string"){j=j.concat(k("getterSetter"))}return(c.inArray(o,j)!=-1)}c.widget=function(k,j){var l=k.split(".")[0];k=k.split(".")[1];c.fn[k]=function(p){var n=(typeof p=="string"),o=Array.prototype.slice.call(arguments,1);if(n&&p.substring(0,1)=="_"){return this}if(n&&g(l,k,p,o)){var m=c.data(this[0],k);return(m?m[p].apply(m,o):undefined)}return this.each(function(){var q=c.data(this,k);(!q&&!n&&c.data(this,k,new c[l][k](this,p))._init());(q&&n&&c.isFunction(q[p])&&q[p].apply(q,o))})};c[l]=c[l]||{};c[l][k]=function(o,n){var m=this;this.namespace=l;this.widgetName=k;this.widgetEventPrefix=c[l][k].eventPrefix||k;this.widgetBaseClass=l+"-"+k;this.options=c.extend({},c.widget.defaults,c[l][k].defaults,c.metadata&&c.metadata.get(o)[k],n);this.element=c(o).bind("setData."+k,function(q,p,r){if(q.target==o){return m._setData(p,r)}}).bind("getData."+k,function(q,p){if(q.target==o){return m._getData(p)}}).bind("remove",function(){return m.destroy()})};c[l][k].prototype=c.extend({},c.widget.prototype,j);c[l][k].getterSetter="option"};c.widget.prototype={_init:function(){},destroy:function(){this.element.removeData(this.widgetName).removeClass(this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").removeAttr("aria-disabled")},option:function(l,m){var k=l,j=this;if(typeof l=="string"){if(m===undefined){return this._getData(l)}k={};k[l]=m}c.each(k,function(n,o){j._setData(n,o)})},_getData:function(j){return this.options[j]},_setData:function(j,k){this.options[j]=k;if(j=="disabled"){this.element[k?"addClass":"removeClass"](this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").attr("aria-disabled",k)}},enable:function(){this._setData("disabled",false)},disable:function(){this._setData("disabled",true)},_trigger:function(l,m,n){var p=this.options[l],j=(l==this.widgetEventPrefix?l:this.widgetEventPrefix+l);m=c.Event(m);m.type=j;if(m.originalEvent){for(var k=c.event.props.length,o;k;){o=c.event.props[--k];m[o]=m.originalEvent[o]}}this.element.trigger(m,n);return !(c.isFunction(p)&&p.call(this.element[0],m,n)===false||m.isDefaultPrevented())}};c.widget.defaults={disabled:false};c.ui.mouse={_mouseInit:function(){var j=this;this.element.bind("mousedown."+this.widgetName,function(k){return j._mouseDown(k)}).bind("click."+this.widgetName,function(k){if(j._preventClickEvent){j._preventClickEvent=false;k.stopImmediatePropagation();return false}});if(c.browser.msie){this._mouseUnselectable=this.element.attr("unselectable");this.element.attr("unselectable","on")}this.started=false},_mouseDestroy:function(){this.element.unbind("."+this.widgetName);(c.browser.msie&&this.element.attr("unselectable",this._mouseUnselectable))},_mouseDown:function(l){l.originalEvent=l.originalEvent||{};if(l.originalEvent.mouseHandled){return}(this._mouseStarted&&this._mouseUp(l));this._mouseDownEvent=l;var k=this,m=(l.which==1),j=(typeof this.options.cancel=="string"?c(l.target).parents().add(l.target).filter(this.options.cancel).length:false);if(!m||j||!this._mouseCapture(l)){return true}this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){k.mouseDelayMet=true},this.options.delay)}if(this._mouseDistanceMet(l)&&this._mouseDelayMet(l)){this._mouseStarted=(this._mouseStart(l)!==false);if(!this._mouseStarted){l.preventDefault();return true}}this._mouseMoveDelegate=function(n){return k._mouseMove(n)};this._mouseUpDelegate=function(n){return k._mouseUp(n)};c(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);(c.browser.safari||l.preventDefault());l.originalEvent.mouseHandled=true;return true},_mouseMove:function(j){if(c.browser.msie&&!j.button){return this._mouseUp(j)}if(this._mouseStarted){this._mouseDrag(j);return j.preventDefault()}if(this._mouseDistanceMet(j)&&this._mouseDelayMet(j)){this._mouseStarted=(this._mouseStart(this._mouseDownEvent,j)!==false);(this._mouseStarted?this._mouseDrag(j):this._mouseUp(j))}return !this._mouseStarted},_mouseUp:function(j){c(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;this._preventClickEvent=(j.target==this._mouseDownEvent.target);this._mouseStop(j)}return false},_mouseDistanceMet:function(j){return(Math.max(Math.abs(this._mouseDownEvent.pageX-j.pageX),Math.abs(this._mouseDownEvent.pageY-j.pageY))>=this.options.distance)},_mouseDelayMet:function(j){return this.mouseDelayMet},_mouseStart:function(j){},_mouseDrag:function(j){},_mouseStop:function(j){},_mouseCapture:function(j){return true}};c.ui.mouse.defaults={cancel:null,distance:1,delay:0}})(jQuery);;/*
- * jQuery UI Draggable 1.7.1
- *
- * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT (MIT-LICENSE.txt)
- * and GPL (GPL-LICENSE.txt) licenses.
- *
- * http://docs.jquery.com/UI/Draggables
- *
- * Depends:
- * ui.core.js
- */
(function(a){a.widget("ui.draggable",a.extend({},a.ui.mouse,{_init:function(){if(this.options.helper=="original"&&!(/^(?:r|a|f)/).test(this.element.css("position"))){this.element[0].style.position="relative"}(this.options.addClasses&&this.element.addClass("ui-draggable"));(this.options.disabled&&this.element.addClass("ui-draggable-disabled"));this._mouseInit()},destroy:function(){if(!this.element.data("draggable")){return}this.element.removeData("draggable").unbind(".draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled");this._mouseDestroy()},_mouseCapture:function(b){var c=this.options;if(this.helper||c.disabled||a(b.target).is(".ui-resizable-handle")){return false}this.handle=this._getHandle(b);if(!this.handle){return false}return true},_mouseStart:function(b){var c=this.options;this.helper=this._createHelper(b);this._cacheHelperProportions();if(a.ui.ddmanager){a.ui.ddmanager.current=this}this._cacheMargins();this.cssPosition=this.helper.css("position");this.scrollParent=this.helper.scrollParent();this.offset=this.element.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};a.extend(this.offset,{click:{left:b.pageX-this.offset.left,top:b.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this._generatePosition(b);this.originalPageX=b.pageX;this.originalPageY=b.pageY;if(c.cursorAt){this._adjustOffsetFromHelper(c.cursorAt)}if(c.containment){this._setContainment()}this._trigger("start",b);this._cacheHelperProportions();if(a.ui.ddmanager&&!c.dropBehaviour){a.ui.ddmanager.prepareOffsets(this,b)}this.helper.addClass("ui-draggable-dragging");this._mouseDrag(b,true);return true},_mouseDrag:function(b,d){this.position=this._generatePosition(b);this.positionAbs=this._convertPositionTo("absolute");if(!d){var c=this._uiHash();this._trigger("drag",b,c);this.position=c.position}if(!this.options.axis||this.options.axis!="y"){this.helper[0].style.left=this.position.left+"px"}if(!this.options.axis||this.options.axis!="x"){this.helper[0].style.top=this.position.top+"px"}if(a.ui.ddmanager){a.ui.ddmanager.drag(this,b)}return false},_mouseStop:function(c){var d=false;if(a.ui.ddmanager&&!this.options.dropBehaviour){d=a.ui.ddmanager.drop(this,c)}if(this.dropped){d=this.dropped;this.dropped=false}if((this.options.revert=="invalid"&&!d)||(this.options.revert=="valid"&&d)||this.options.revert===true||(a.isFunction(this.options.revert)&&this.options.revert.call(this.element,d))){var b=this;a(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){b._trigger("stop",c);b._clear()})}else{this._trigger("stop",c);this._clear()}return false},_getHandle:function(b){var c=!this.options.handle||!a(this.options.handle,this.element).length?true:false;a(this.options.handle,this.element).find("*").andSelf().each(function(){if(this==b.target){c=true}});return c},_createHelper:function(c){var d=this.options;var b=a.isFunction(d.helper)?a(d.helper.apply(this.element[0],[c])):(d.helper=="clone"?this.element.clone():this.element);if(!b.parents("body").length){b.appendTo((d.appendTo=="parent"?this.element[0].parentNode:d.appendTo))}if(b[0]!=this.element[0]&&!(/(fixed|absolute)/).test(b.css("position"))){b.css("position","absolute")}return b},_adjustOffsetFromHelper:function(b){if(b.left!=undefined){this.offset.click.left=b.left+this.margins.left}if(b.right!=undefined){this.offset.click.left=this.helperProportions.width-b.right+this.margins.left}if(b.top!=undefined){this.offset.click.top=b.top+this.margins.top}if(b.bottom!=undefined){this.offset.click.top=this.helperProportions.height-b.bottom+this.margins.top}},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var b=this.offsetParent.offset();if(this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0])){b.left+=this.scrollParent.scrollLeft();b.top+=this.scrollParent.scrollTop()}if((this.offsetParent[0]==document.body)||(this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&a.browser.msie)){b={top:0,left:0}}return{top:b.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:b.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var b=this.element.position();return{top:b.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:b.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}else{return{top:0,left:0}}},_cacheMargins:function(){this.margins={left:(parseInt(this.element.css("marginLeft"),10)||0),top:(parseInt(this.element.css("marginTop"),10)||0)}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var e=this.options;if(e.containment=="parent"){e.containment=this.helper[0].parentNode}if(e.containment=="document"||e.containment=="window"){this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,a(e.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(a(e.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]}if(!(/^(document|window|parent)$/).test(e.containment)&&e.containment.constructor!=Array){var c=a(e.containment)[0];if(!c){return}var d=a(e.containment).offset();var b=(a(c).css("overflow")!="hidden");this.containment=[d.left+(parseInt(a(c).css("borderLeftWidth"),10)||0)+(parseInt(a(c).css("paddingLeft"),10)||0)-this.margins.left,d.top+(parseInt(a(c).css("borderTopWidth"),10)||0)+(parseInt(a(c).css("paddingTop"),10)||0)-this.margins.top,d.left+(b?Math.max(c.scrollWidth,c.offsetWidth):c.offsetWidth)-(parseInt(a(c).css("borderLeftWidth"),10)||0)-(parseInt(a(c).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,d.top+(b?Math.max(c.scrollHeight,c.offsetHeight):c.offsetHeight)-(parseInt(a(c).css("borderTopWidth"),10)||0)-(parseInt(a(c).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top]}else{if(e.containment.constructor==Array){this.containment=e.containment}}},_convertPositionTo:function(f,h){if(!h){h=this.position}var c=f=="absolute"?1:-1;var e=this.options,b=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,g=(/(html|body)/i).test(b[0].tagName);return{top:(h.top+this.offset.relative.top*c+this.offset.parent.top*c-(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():(g?0:b.scrollTop()))*c)),left:(h.left+this.offset.relative.left*c+this.offset.parent.left*c-(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():g?0:b.scrollLeft())*c))}},_generatePosition:function(e){var h=this.options,b=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,i=(/(html|body)/i).test(b[0].tagName);if(this.cssPosition=="relative"&&!(this.scrollParent[0]!=document&&this.scrollParent[0]!=this.offsetParent[0])){this.offset.relative=this._getRelativeOffset()}var d=e.pageX;var c=e.pageY;if(this.originalPosition){if(this.containment){if(e.pageX-this.offset.click.left<this.containment[0]){d=this.containment[0]+this.offset.click.left}if(e.pageY-this.offset.click.top<this.containment[1]){c=this.containment[1]+this.offset.click.top}if(e.pageX-this.offset.click.left>this.containment[2]){d=this.containment[2]+this.offset.click.left}if(e.pageY-this.offset.click.top>this.containment[3]){c=this.containment[3]+this.offset.click.top}}if(h.grid){var g=this.originalPageY+Math.round((c-this.originalPageY)/h.grid[1])*h.grid[1];c=this.containment?(!(g-this.offset.click.top<this.containment[1]||g-this.offset.click.top>this.containment[3])?g:(!(g-this.offset.click.top<this.containment[1])?g-h.grid[1]:g+h.grid[1])):g;var f=this.originalPageX+Math.round((d-this.originalPageX)/h.grid[0])*h.grid[0];d=this.containment?(!(f-this.offset.click.left<this.containment[0]||f-this.offset.click.left>this.containment[2])?f:(!(f-this.offset.click.left<this.containment[0])?f-h.grid[0]:f+h.grid[0])):f}}return{top:(c-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():(i?0:b.scrollTop())))),left:(d-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():i?0:b.scrollLeft())))}},_clear:function(){this.helper.removeClass("ui-draggable-dragging");if(this.helper[0]!=this.element[0]&&!this.cancelHelperRemoval){this.helper.remove()}this.helper=null;this.cancelHelperRemoval=false},_trigger:function(b,c,d){d=d||this._uiHash();a.ui.plugin.call(this,b,[c,d]);if(b=="drag"){this.positionAbs=this._convertPositionTo("absolute")}return a.widget.prototype._trigger.call(this,b,c,d)},plugins:{},_uiHash:function(b){return{helper:this.helper,position:this.position,absolutePosition:this.positionAbs,offset:this.positionAbs}}}));a.extend(a.ui.draggable,{version:"1.7.1",eventPrefix:"drag",defaults:{addClasses:true,appendTo:"parent",axis:false,cancel:":input,option",connectToSortable:false,containment:false,cursor:"auto",cursorAt:false,delay:0,distance:1,grid:false,handle:false,helper:"original",iframeFix:false,opacity:false,refreshPositions:false,revert:false,revertDuration:500,scope:"default",scroll:true,scrollSensitivity:20,scrollSpeed:20,snap:false,snapMode:"both",snapTolerance:20,stack:false,zIndex:false}});a.ui.plugin.add("draggable","connectToSortable",{start:function(c,e){var d=a(this).data("draggable"),f=d.options,b=a.extend({},e,{item:d.element});d.sortables=[];a(f.connectToSortable).each(function(){var g=a.data(this,"sortable");if(g&&!g.options.disabled){d.sortables.push({instance:g,shouldRevert:g.options.revert});g._refreshItems();g._trigger("activate",c,b)}})},stop:function(c,e){var d=a(this).data("draggable"),b=a.extend({},e,{item:d.element});a.each(d.sortables,function(){if(this.instance.isOver){this.instance.isOver=0;d.cancelHelperRemoval=true;this.instance.cancelHelperRemoval=false;if(this.shouldRevert){this.instance.options.revert=true}this.instance._mouseStop(c);this.instance.options.helper=this.instance.options._helper;if(d.options.helper=="original"){this.instance.currentItem.css({top:"auto",left:"auto"})}}else{this.instance.cancelHelperRemoval=false;this.instance._trigger("deactivate",c,b)}})},drag:function(c,f){var e=a(this).data("draggable"),b=this;var d=function(i){var n=this.offset.click.top,m=this.offset.click.left;var g=this.positionAbs.top,k=this.positionAbs.left;var j=i.height,l=i.width;var p=i.top,h=i.left;return a.ui.isOver(g+n,k+m,p,h,j,l)};a.each(e.sortables,function(g){this.instance.positionAbs=e.positionAbs;this.instance.helperProportions=e.helperProportions;this.instance.offset.click=e.offset.click;if(this.instance._intersectsWith(this.instance.containerCache)){if(!this.instance.isOver){this.instance.isOver=1;this.instance.currentItem=a(b).clone().appendTo(this.instance.element).data("sortable-item",true);this.instance.options._helper=this.instance.options.helper;this.instance.options.helper=function(){return f.helper[0]};c.target=this.instance.currentItem[0];this.instance._mouseCapture(c,true);this.instance._mouseStart(c,true,true);this.instance.offset.click.top=e.offset.click.top;this.instance.offset.click.left=e.offset.click.left;this.instance.offset.parent.left-=e.offset.parent.left-this.instance.offset.parent.left;this.instance.offset.parent.top-=e.offset.parent.top-this.instance.offset.parent.top;e._trigger("toSortable",c);e.dropped=this.instance.element;e.currentItem=e.element;this.instance.fromOutside=e}if(this.instance.currentItem){this.instance._mouseDrag(c)}}else{if(this.instance.isOver){this.instance.isOver=0;this.instance.cancelHelperRemoval=true;this.instance.options.revert=false;this.instance._trigger("out",c,this.instance._uiHash(this.instance));this.instance._mouseStop(c,true);this.instance.options.helper=this.instance.options._helper;this.instance.currentItem.remove();if(this.instance.placeholder){this.instance.placeholder.remove()}e._trigger("fromSortable",c);e.dropped=false}}})}});a.ui.plugin.add("draggable","cursor",{start:function(c,d){var b=a("body"),e=a(this).data("draggable").options;if(b.css("cursor")){e._cursor=b.css("cursor")}b.css("cursor",e.cursor)},stop:function(b,c){var d=a(this).data("draggable").options;if(d._cursor){a("body").css("cursor",d._cursor)}}});a.ui.plugin.add("draggable","iframeFix",{start:function(b,c){var d=a(this).data("draggable").options;a(d.iframeFix===true?"iframe":d.iframeFix).each(function(){a('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>').css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1000}).css(a(this).offset()).appendTo("body")})},stop:function(b,c){a("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)})}});a.ui.plugin.add("draggable","opacity",{start:function(c,d){var b=a(d.helper),e=a(this).data("draggable").options;if(b.css("opacity")){e._opacity=b.css("opacity")}b.css("opacity",e.opacity)},stop:function(b,c){var d=a(this).data("draggable").options;if(d._opacity){a(c.helper).css("opacity",d._opacity)}}});a.ui.plugin.add("draggable","scroll",{start:function(c,d){var b=a(this).data("draggable");if(b.scrollParent[0]!=document&&b.scrollParent[0].tagName!="HTML"){b.overflowOffset=b.scrollParent.offset()}},drag:function(d,e){var c=a(this).data("draggable"),f=c.options,b=false;if(c.scrollParent[0]!=document&&c.scrollParent[0].tagName!="HTML"){if(!f.axis||f.axis!="x"){if((c.overflowOffset.top+c.scrollParent[0].offsetHeight)-d.pageY<f.scrollSensitivity){c.scrollParent[0].scrollTop=b=c.scrollParent[0].scrollTop+f.scrollSpeed}else{if(d.pageY-c.overflowOffset.top<f.scrollSensitivity){c.scrollParent[0].scrollTop=b=c.scrollParent[0].scrollTop-f.scrollSpeed}}}if(!f.axis||f.axis!="y"){if((c.overflowOffset.left+c.scrollParent[0].offsetWidth)-d.pageX<f.scrollSensitivity){c.scrollParent[0].scrollLeft=b=c.scrollParent[0].scrollLeft+f.scrollSpeed}else{if(d.pageX-c.overflowOffset.left<f.scrollSensitivity){c.scrollParent[0].scrollLeft=b=c.scrollParent[0].scrollLeft-f.scrollSpeed}}}}else{if(!f.axis||f.axis!="x"){if(d.pageY-a(document).scrollTop()<f.scrollSensitivity){b=a(document).scrollTop(a(document).scrollTop()-f.scrollSpeed)}else{if(a(window).height()-(d.pageY-a(document).scrollTop())<f.scrollSensitivity){b=a(document).scrollTop(a(document).scrollTop()+f.scrollSpeed)}}}if(!f.axis||f.axis!="y"){if(d.pageX-a(document).scrollLeft()<f.scrollSensitivity){b=a(document).scrollLeft(a(document).scrollLeft()-f.scrollSpeed)}else{if(a(window).width()-(d.pageX-a(document).scrollLeft())<f.scrollSensitivity){b=a(document).scrollLeft(a(document).scrollLeft()+f.scrollSpeed)}}}}if(b!==false&&a.ui.ddmanager&&!f.dropBehaviour){a.ui.ddmanager.prepareOffsets(c,d)}}});a.ui.plugin.add("draggable","snap",{start:function(c,d){var b=a(this).data("draggable"),e=b.options;b.snapElements=[];a(e.snap.constructor!=String?(e.snap.items||":data(draggable)"):e.snap).each(function(){var g=a(this);var f=g.offset();if(this!=b.element[0]){b.snapElements.push({item:this,width:g.outerWidth(),height:g.outerHeight(),top:f.top,left:f.left})}})},drag:function(u,p){var g=a(this).data("draggable"),q=g.options;var y=q.snapTolerance;var x=p.offset.left,w=x+g.helperProportions.width,f=p.offset.top,e=f+g.helperProportions.height;for(var v=g.snapElements.length-1;v>=0;v--){var s=g.snapElements[v].left,n=s+g.snapElements[v].width,m=g.snapElements[v].top,A=m+g.snapElements[v].height;if(!((s-y<x&&x<n+y&&m-y<f&&f<A+y)||(s-y<x&&x<n+y&&m-y<e&&e<A+y)||(s-y<w&&w<n+y&&m-y<f&&f<A+y)||(s-y<w&&w<n+y&&m-y<e&&e<A+y))){if(g.snapElements[v].snapping){(g.options.snap.release&&g.options.snap.release.call(g.element,u,a.extend(g._uiHash(),{snapItem:g.snapElements[v].item})))}g.snapElements[v].snapping=false;continue}if(q.snapMode!="inner"){var c=Math.abs(m-e)<=y;var z=Math.abs(A-f)<=y;var j=Math.abs(s-w)<=y;var k=Math.abs(n-x)<=y;if(c){p.position.top=g._convertPositionTo("relative",{top:m-g.helperProportions.height,left:0}).top-g.margins.top}if(z){p.position.top=g._convertPositionTo("relative",{top:A,left:0}).top-g.margins.top}if(j){p.position.left=g._convertPositionTo("relative",{top:0,left:s-g.helperProportions.width}).left-g.margins.left}if(k){p.position.left=g._convertPositionTo("relative",{top:0,left:n}).left-g.margins.left}}var h=(c||z||j||k);if(q.snapMode!="outer"){var c=Math.abs(m-f)<=y;var z=Math.abs(A-e)<=y;var j=Math.abs(s-x)<=y;var k=Math.abs(n-w)<=y;if(c){p.position.top=g._convertPositionTo("relative",{top:m,left:0}).top-g.margins.top}if(z){p.position.top=g._convertPositionTo("relative",{top:A-g.helperProportions.height,left:0}).top-g.margins.top}if(j){p.position.left=g._convertPositionTo("relative",{top:0,left:s}).left-g.margins.left}if(k){p.position.left=g._convertPositionTo("relative",{top:0,left:n-g.helperProportions.width}).left-g.margins.left}}if(!g.snapElements[v].snapping&&(c||z||j||k||h)){(g.options.snap.snap&&g.options.snap.snap.call(g.element,u,a.extend(g._uiHash(),{snapItem:g.snapElements[v].item})))}g.snapElements[v].snapping=(c||z||j||k||h)}}});a.ui.plugin.add("draggable","stack",{start:function(b,c){var e=a(this).data("draggable").options;var d=a.makeArray(a(e.stack.group)).sort(function(g,f){return(parseInt(a(g).css("zIndex"),10)||e.stack.min)-(parseInt(a(f).css("zIndex"),10)||e.stack.min)});a(d).each(function(f){this.style.zIndex=e.stack.min+f});this[0].style.zIndex=e.stack.min+d.length}});a.ui.plugin.add("draggable","zIndex",{start:function(c,d){var b=a(d.helper),e=a(this).data("draggable").options;if(b.css("zIndex")){e._zIndex=b.css("zIndex")}b.css("zIndex",e.zIndex)},stop:function(b,c){var d=a(this).data("draggable").options;if(d._zIndex){a(c.helper).css("zIndex",d._zIndex)}}})})(jQuery);;/*
- * jQuery UI Droppable 1.7.1
- *
- * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT (MIT-LICENSE.txt)
- * and GPL (GPL-LICENSE.txt) licenses.
- *
- * http://docs.jquery.com/UI/Droppables
- *
- * Depends:
- * ui.core.js
- * ui.draggable.js
- */
(function(a){a.widget("ui.droppable",{_init:function(){var c=this.options,b=c.accept;this.isover=0;this.isout=1;this.options.accept=this.options.accept&&a.isFunction(this.options.accept)?this.options.accept:function(e){return e.is(b)};this.proportions={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight};a.ui.ddmanager.droppables[this.options.scope]=a.ui.ddmanager.droppables[this.options.scope]||[];a.ui.ddmanager.droppables[this.options.scope].push(this);(this.options.addClasses&&this.element.addClass("ui-droppable"))},destroy:function(){var b=a.ui.ddmanager.droppables[this.options.scope];for(var c=0;c<b.length;c++){if(b[c]==this){b.splice(c,1)}}this.element.removeClass("ui-droppable ui-droppable-disabled").removeData("droppable").unbind(".droppable")},_setData:function(b,c){if(b=="accept"){this.options.accept=c&&a.isFunction(c)?c:function(e){return e.is(c)}}else{a.widget.prototype._setData.apply(this,arguments)}},_activate:function(c){var b=a.ui.ddmanager.current;if(this.options.activeClass){this.element.addClass(this.options.activeClass)}(b&&this._trigger("activate",c,this.ui(b)))},_deactivate:function(c){var b=a.ui.ddmanager.current;if(this.options.activeClass){this.element.removeClass(this.options.activeClass)}(b&&this._trigger("deactivate",c,this.ui(b)))},_over:function(c){var b=a.ui.ddmanager.current;if(!b||(b.currentItem||b.element)[0]==this.element[0]){return}if(this.options.accept.call(this.element[0],(b.currentItem||b.element))){if(this.options.hoverClass){this.element.addClass(this.options.hoverClass)}this._trigger("over",c,this.ui(b))}},_out:function(c){var b=a.ui.ddmanager.current;if(!b||(b.currentItem||b.element)[0]==this.element[0]){return}if(this.options.accept.call(this.element[0],(b.currentItem||b.element))){if(this.options.hoverClass){this.element.removeClass(this.options.hoverClass)}this._trigger("out",c,this.ui(b))}},_drop:function(c,d){var b=d||a.ui.ddmanager.current;if(!b||(b.currentItem||b.element)[0]==this.element[0]){return false}var e=false;this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function(){var f=a.data(this,"droppable");if(f.options.greedy&&a.ui.intersect(b,a.extend(f,{offset:f.element.offset()}),f.options.tolerance)){e=true;return false}});if(e){return false}if(this.options.accept.call(this.element[0],(b.currentItem||b.element))){if(this.options.activeClass){this.element.removeClass(this.options.activeClass)}if(this.options.hoverClass){this.element.removeClass(this.options.hoverClass)}this._trigger("drop",c,this.ui(b));return this.element}return false},ui:function(b){return{draggable:(b.currentItem||b.element),helper:b.helper,position:b.position,absolutePosition:b.positionAbs,offset:b.positionAbs}}});a.extend(a.ui.droppable,{version:"1.7.1",eventPrefix:"drop",defaults:{accept:"*",activeClass:false,addClasses:true,greedy:false,hoverClass:false,scope:"default",tolerance:"intersect"}});a.ui.intersect=function(q,j,o){if(!j.offset){return false}var e=(q.positionAbs||q.position.absolute).left,d=e+q.helperProportions.width,n=(q.positionAbs||q.position.absolute).top,m=n+q.helperProportions.height;var g=j.offset.left,c=g+j.proportions.width,p=j.offset.top,k=p+j.proportions.height;switch(o){case"fit":return(g<e&&d<c&&p<n&&m<k);break;case"intersect":return(g<e+(q.helperProportions.width/2)&&d-(q.helperProportions.width/2)<c&&p<n+(q.helperProportions.height/2)&&m-(q.helperProportions.height/2)<k);break;case"pointer":var h=((q.positionAbs||q.position.absolute).left+(q.clickOffset||q.offset.click).left),i=((q.positionAbs||q.position.absolute).top+(q.clickOffset||q.offset.click).top),f=a.ui.isOver(i,h,p,g,j.proportions.height,j.proportions.width);return f;break;case"touch":return((n>=p&&n<=k)||(m>=p&&m<=k)||(n<p&&m>k))&&((e>=g&&e<=c)||(d>=g&&d<=c)||(e<g&&d>c));break;default:return false;break}};a.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(e,g){var b=a.ui.ddmanager.droppables[e.options.scope];var f=g?g.type:null;var h=(e.currentItem||e.element).find(":data(droppable)").andSelf();droppablesLoop:for(var d=0;d<b.length;d++){if(b[d].options.disabled||(e&&!b[d].options.accept.call(b[d].element[0],(e.currentItem||e.element)))){continue}for(var c=0;c<h.length;c++){if(h[c]==b[d].element[0]){b[d].proportions.height=0;continue droppablesLoop}}b[d].visible=b[d].element.css("display")!="none";if(!b[d].visible){continue}b[d].offset=b[d].element.offset();b[d].proportions={width:b[d].element[0].offsetWidth,height:b[d].element[0].offsetHeight};if(f=="mousedown"){b[d]._activate.call(b[d],g)}}},drop:function(b,c){var d=false;a.each(a.ui.ddmanager.droppables[b.options.scope],function(){if(!this.options){return}if(!this.options.disabled&&this.visible&&a.ui.intersect(b,this,this.options.tolerance)){d=this._drop.call(this,c)}if(!this.options.disabled&&this.visible&&this.options.accept.call(this.element[0],(b.currentItem||b.element))){this.isout=1;this.isover=0;this._deactivate.call(this,c)}});return d},drag:function(b,c){if(b.options.refreshPositions){a.ui.ddmanager.prepareOffsets(b,c)}a.each(a.ui.ddmanager.droppables[b.options.scope],function(){if(this.options.disabled||this.greedyChild||!this.visible){return}var e=a.ui.intersect(b,this,this.options.tolerance);var g=!e&&this.isover==1?"isout":(e&&this.isover==0?"isover":null);if(!g){return}var f;if(this.options.greedy){var d=this.element.parents(":data(droppable):eq(0)");if(d.length){f=a.data(d[0],"droppable");f.greedyChild=(g=="isover"?1:0)}}if(f&&g=="isover"){f.isover=0;f.isout=1;f._out.call(f,c)}this[g]=1;this[g=="isout"?"isover":"isout"]=0;this[g=="isover"?"_over":"_out"].call(this,c);if(f&&g=="isout"){f.isout=0;f.isover=1;f._over.call(f,c)}})}}})(jQuery);;/*
- * jQuery UI Resizable 1.7.1
- *
- * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT (MIT-LICENSE.txt)
- * and GPL (GPL-LICENSE.txt) licenses.
- *
- * http://docs.jquery.com/UI/Resizables
- *
- * Depends:
- * ui.core.js
- */
(function(c){c.widget("ui.resizable",c.extend({},c.ui.mouse,{_init:function(){var e=this,j=this.options;this.element.addClass("ui-resizable");c.extend(this,{_aspectRatio:!!(j.aspectRatio),aspectRatio:j.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:j.helper||j.ghost||j.animate?j.helper||"ui-resizable-helper":null});if(this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)){if(/relative/.test(this.element.css("position"))&&c.browser.opera){this.element.css({position:"relative",top:"auto",left:"auto"})}this.element.wrap(c('<div class="ui-wrapper" style="overflow: hidden;"></div>').css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")}));this.element=this.element.parent().data("resizable",this.element.data("resizable"));this.elementIsWrapper=true;this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")});this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0});this.originalResizeStyle=this.originalElement.css("resize");this.originalElement.css("resize","none");this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"}));this.originalElement.css({margin:this.originalElement.css("margin")});this._proportionallyResize()}this.handles=j.handles||(!c(".ui-resizable-handle",this.element).length?"e,s,se":{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"});if(this.handles.constructor==String){if(this.handles=="all"){this.handles="n,e,s,w,se,sw,ne,nw"}var k=this.handles.split(",");this.handles={};for(var f=0;f<k.length;f++){var h=c.trim(k[f]),d="ui-resizable-"+h;var g=c('<div class="ui-resizable-handle '+d+'"></div>');if(/sw|se|ne|nw/.test(h)){g.css({zIndex:++j.zIndex})}if("se"==h){g.addClass("ui-icon ui-icon-gripsmall-diagonal-se")}this.handles[h]=".ui-resizable-"+h;this.element.append(g)}}this._renderAxis=function(p){p=p||this.element;for(var m in this.handles){if(this.handles[m].constructor==String){this.handles[m]=c(this.handles[m],this.element).show()}if(this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)){var n=c(this.handles[m],this.element),o=0;o=/sw|ne|nw|se|n|s/.test(m)?n.outerHeight():n.outerWidth();var l=["padding",/ne|nw|n/.test(m)?"Top":/se|sw|s/.test(m)?"Bottom":/^e$/.test(m)?"Right":"Left"].join("");p.css(l,o);this._proportionallyResize()}if(!c(this.handles[m]).length){continue}}};this._renderAxis(this.element);this._handles=c(".ui-resizable-handle",this.element).disableSelection();this._handles.mouseover(function(){if(!e.resizing){if(this.className){var i=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)}e.axis=i&&i[1]?i[1]:"se"}});if(j.autoHide){this._handles.hide();c(this.element).addClass("ui-resizable-autohide").hover(function(){c(this).removeClass("ui-resizable-autohide");e._handles.show()},function(){if(!e.resizing){c(this).addClass("ui-resizable-autohide");e._handles.hide()}})}this._mouseInit()},destroy:function(){this._mouseDestroy();var d=function(f){c(f).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};if(this.elementIsWrapper){d(this.element);var e=this.element;e.parent().append(this.originalElement.css({position:e.css("position"),width:e.outerWidth(),height:e.outerHeight(),top:e.css("top"),left:e.css("left")})).end().remove()}this.originalElement.css("resize",this.originalResizeStyle);d(this.originalElement)},_mouseCapture:function(e){var f=false;for(var d in this.handles){if(c(this.handles[d])[0]==e.target){f=true}}return this.options.disabled||!!f},_mouseStart:function(f){var i=this.options,e=this.element.position(),d=this.element;this.resizing=true;this.documentScroll={top:c(document).scrollTop(),left:c(document).scrollLeft()};if(d.is(".ui-draggable")||(/absolute/).test(d.css("position"))){d.css({position:"absolute",top:e.top,left:e.left})}if(c.browser.opera&&(/relative/).test(d.css("position"))){d.css({position:"relative",top:"auto",left:"auto"})}this._renderProxy();var j=b(this.helper.css("left")),g=b(this.helper.css("top"));if(i.containment){j+=c(i.containment).scrollLeft()||0;g+=c(i.containment).scrollTop()||0}this.offset=this.helper.offset();this.position={left:j,top:g};this.size=this._helper?{width:d.outerWidth(),height:d.outerHeight()}:{width:d.width(),height:d.height()};this.originalSize=this._helper?{width:d.outerWidth(),height:d.outerHeight()}:{width:d.width(),height:d.height()};this.originalPosition={left:j,top:g};this.sizeDiff={width:d.outerWidth()-d.width(),height:d.outerHeight()-d.height()};this.originalMousePosition={left:f.pageX,top:f.pageY};this.aspectRatio=(typeof i.aspectRatio=="number")?i.aspectRatio:((this.originalSize.width/this.originalSize.height)||1);var h=c(".ui-resizable-"+this.axis).css("cursor");c("body").css("cursor",h=="auto"?this.axis+"-resize":h);d.addClass("ui-resizable-resizing");this._propagate("start",f);return true},_mouseDrag:function(d){var g=this.helper,f=this.options,l={},p=this,i=this.originalMousePosition,m=this.axis;var q=(d.pageX-i.left)||0,n=(d.pageY-i.top)||0;var h=this._change[m];if(!h){return false}var k=h.apply(this,[d,q,n]),j=c.browser.msie&&c.browser.version<7,e=this.sizeDiff;if(this._aspectRatio||d.shiftKey){k=this._updateRatio(k,d)}k=this._respectSize(k,d);this._propagate("resize",d);g.css({top:this.position.top+"px",left:this.position.left+"px",width:this.size.width+"px",height:this.size.height+"px"});if(!this._helper&&this._proportionallyResizeElements.length){this._proportionallyResize()}this._updateCache(k);this._trigger("resize",d,this.ui());return false},_mouseStop:function(g){this.resizing=false;var h=this.options,l=this;if(this._helper){var f=this._proportionallyResizeElements,d=f.length&&(/textarea/i).test(f[0].nodeName),e=d&&c.ui.hasScroll(f[0],"left")?0:l.sizeDiff.height,j=d?0:l.sizeDiff.width;var m={width:(l.size.width-j),height:(l.size.height-e)},i=(parseInt(l.element.css("left"),10)+(l.position.left-l.originalPosition.left))||null,k=(parseInt(l.element.css("top"),10)+(l.position.top-l.originalPosition.top))||null;if(!h.animate){this.element.css(c.extend(m,{top:k,left:i}))}l.helper.height(l.size.height);l.helper.width(l.size.width);if(this._helper&&!h.animate){this._proportionallyResize()}}c("body").css("cursor","auto");this.element.removeClass("ui-resizable-resizing");this._propagate("stop",g);if(this._helper){this.helper.remove()}return false},_updateCache:function(d){var e=this.options;this.offset=this.helper.offset();if(a(d.left)){this.position.left=d.left}if(a(d.top)){this.position.top=d.top}if(a(d.height)){this.size.height=d.height}if(a(d.width)){this.size.width=d.width}},_updateRatio:function(g,f){var h=this.options,i=this.position,e=this.size,d=this.axis;if(g.height){g.width=(e.height*this.aspectRatio)}else{if(g.width){g.height=(e.width/this.aspectRatio)}}if(d=="sw"){g.left=i.left+(e.width-g.width);g.top=null}if(d=="nw"){g.top=i.top+(e.height-g.height);g.left=i.left+(e.width-g.width)}return g},_respectSize:function(k,f){var i=this.helper,h=this.options,q=this._aspectRatio||f.shiftKey,p=this.axis,s=a(k.width)&&h.maxWidth&&(h.maxWidth<k.width),l=a(k.height)&&h.maxHeight&&(h.maxHeight<k.height),g=a(k.width)&&h.minWidth&&(h.minWidth>k.width),r=a(k.height)&&h.minHeight&&(h.minHeight>k.height);if(g){k.width=h.minWidth}if(r){k.height=h.minHeight}if(s){k.width=h.maxWidth}if(l){k.height=h.maxHeight}var e=this.originalPosition.left+this.originalSize.width,n=this.position.top+this.size.height;var j=/sw|nw|w/.test(p),d=/nw|ne|n/.test(p);if(g&&j){k.left=e-h.minWidth}if(s&&j){k.left=e-h.maxWidth}if(r&&d){k.top=n-h.minHeight}if(l&&d){k.top=n-h.maxHeight}var m=!k.width&&!k.height;if(m&&!k.left&&k.top){k.top=null}else{if(m&&!k.top&&k.left){k.left=null}}return k},_proportionallyResize:function(){var j=this.options;if(!this._proportionallyResizeElements.length){return}var f=this.helper||this.element;for(var e=0;e<this._proportionallyResizeElements.length;e++){var g=this._proportionallyResizeElements[e];if(!this.borderDif){var d=[g.css("borderTopWidth"),g.css("borderRightWidth"),g.css("borderBottomWidth"),g.css("borderLeftWidth")],h=[g.css("paddingTop"),g.css("paddingRight"),g.css("paddingBottom"),g.css("paddingLeft")];this.borderDif=c.map(d,function(k,m){var l=parseInt(k,10)||0,n=parseInt(h[m],10)||0;return l+n})}if(c.browser.msie&&!(!(c(f).is(":hidden")||c(f).parents(":hidden").length))){continue}g.css({height:(f.height()-this.borderDif[0]-this.borderDif[2])||0,width:(f.width()-this.borderDif[1]-this.borderDif[3])||0})}},_renderProxy:function(){var e=this.element,h=this.options;this.elementOffset=e.offset();if(this._helper){this.helper=this.helper||c('<div style="overflow:hidden;"></div>');var d=c.browser.msie&&c.browser.version<7,f=(d?1:0),g=(d?2:-1);this.helper.addClass(this._helper).css({width:this.element.outerWidth()+g,height:this.element.outerHeight()+g,position:"absolute",left:this.elementOffset.left-f+"px",top:this.elementOffset.top-f+"px",zIndex:++h.zIndex});this.helper.appendTo("body").disableSelection()}else{this.helper=this.element}},_change:{e:function(f,e,d){return{width:this.originalSize.width+e}},w:function(g,e,d){var i=this.options,f=this.originalSize,h=this.originalPosition;return{left:h.left+e,width:f.width-e}},n:function(g,e,d){var i=this.options,f=this.originalSize,h=this.originalPosition;return{top:h.top+d,height:f.height-d}},s:function(f,e,d){return{height:this.originalSize.height+d}},se:function(f,e,d){return c.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[f,e,d]))},sw:function(f,e,d){return c.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[f,e,d]))},ne:function(f,e,d){return c.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[f,e,d]))},nw:function(f,e,d){return c.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[f,e,d]))}},_propagate:function(e,d){c.ui.plugin.call(this,e,[d,this.ui()]);(e!="resize"&&this._trigger(e,d,this.ui()))},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}}));c.extend(c.ui.resizable,{version:"1.7.1",eventPrefix:"resize",defaults:{alsoResize:false,animate:false,animateDuration:"slow",animateEasing:"swing",aspectRatio:false,autoHide:false,cancel:":input,option",containment:false,delay:0,distance:1,ghost:false,grid:false,handles:"e,s,se",helper:false,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:1000}});c.ui.plugin.add("resizable","alsoResize",{start:function(e,f){var d=c(this).data("resizable"),g=d.options;_store=function(h){c(h).each(function(){c(this).data("resizable-alsoresize",{width:parseInt(c(this).width(),10),height:parseInt(c(this).height(),10),left:parseInt(c(this).css("left"),10),top:parseInt(c(this).css("top"),10)})})};if(typeof(g.alsoResize)=="object"&&!g.alsoResize.parentNode){if(g.alsoResize.length){g.alsoResize=g.alsoResize[0];_store(g.alsoResize)}else{c.each(g.alsoResize,function(h,i){_store(h)})}}else{_store(g.alsoResize)}},resize:function(f,h){var e=c(this).data("resizable"),i=e.options,g=e.originalSize,k=e.originalPosition;var j={height:(e.size.height-g.height)||0,width:(e.size.width-g.width)||0,top:(e.position.top-k.top)||0,left:(e.position.left-k.left)||0},d=function(l,m){c(l).each(function(){var p=c(this),q=c(this).data("resizable-alsoresize"),o={},n=m&&m.length?m:["width","height","top","left"];c.each(n||["width","height","top","left"],function(r,t){var s=(q[t]||0)+(j[t]||0);if(s&&s>=0){o[t]=s||null}});if(/relative/.test(p.css("position"))&&c.browser.opera){e._revertToRelativePosition=true;p.css({position:"absolute",top:"auto",left:"auto"})}p.css(o)})};if(typeof(i.alsoResize)=="object"&&!i.alsoResize.nodeType){c.each(i.alsoResize,function(l,m){d(l,m)})}else{d(i.alsoResize)}},stop:function(e,f){var d=c(this).data("resizable");if(d._revertToRelativePosition&&c.browser.opera){d._revertToRelativePosition=false;el.css({position:"relative"})}c(this).removeData("resizable-alsoresize-start")}});c.ui.plugin.add("resizable","animate",{stop:function(h,m){var n=c(this).data("resizable"),i=n.options;var g=n._proportionallyResizeElements,d=g.length&&(/textarea/i).test(g[0].nodeName),e=d&&c.ui.hasScroll(g[0],"left")?0:n.sizeDiff.height,k=d?0:n.sizeDiff.width;var f={width:(n.size.width-k),height:(n.size.height-e)},j=(parseInt(n.element.css("left"),10)+(n.position.left-n.originalPosition.left))||null,l=(parseInt(n.element.css("top"),10)+(n.position.top-n.originalPosition.top))||null;n.element.animate(c.extend(f,l&&j?{top:l,left:j}:{}),{duration:i.animateDuration,easing:i.animateEasing,step:function(){var o={width:parseInt(n.element.css("width"),10),height:parseInt(n.element.css("height"),10),top:parseInt(n.element.css("top"),10),left:parseInt(n.element.css("left"),10)};if(g&&g.length){c(g[0]).css({width:o.width,height:o.height})}n._updateCache(o);n._propagate("resize",h)}})}});c.ui.plugin.add("resizable","containment",{start:function(e,q){var s=c(this).data("resizable"),i=s.options,k=s.element;var f=i.containment,j=(f instanceof c)?f.get(0):(/parent/.test(f))?k.parent().get(0):f;if(!j){return}s.containerElement=c(j);if(/document/.test(f)||f==document){s.containerOffset={left:0,top:0};s.containerPosition={left:0,top:0};s.parentData={element:c(document),left:0,top:0,width:c(document).width(),height:c(document).height()||document.body.parentNode.scrollHeight}}else{var m=c(j),h=[];c(["Top","Right","Left","Bottom"]).each(function(p,o){h[p]=b(m.css("padding"+o))});s.containerOffset=m.offset();s.containerPosition=m.position();s.containerSize={height:(m.innerHeight()-h[3]),width:(m.innerWidth()-h[1])};var n=s.containerOffset,d=s.containerSize.height,l=s.containerSize.width,g=(c.ui.hasScroll(j,"left")?j.scrollWidth:l),r=(c.ui.hasScroll(j)?j.scrollHeight:d);s.parentData={element:j,left:n.left,top:n.top,width:g,height:r}}},resize:function(f,p){var s=c(this).data("resizable"),h=s.options,e=s.containerSize,n=s.containerOffset,l=s.size,m=s.position,q=s._aspectRatio||f.shiftKey,d={top:0,left:0},g=s.containerElement;if(g[0]!=document&&(/static/).test(g.css("position"))){d=n}if(m.left<(s._helper?n.left:0)){s.size.width=s.size.width+(s._helper?(s.position.left-n.left):(s.position.left-d.left));if(q){s.size.height=s.size.width/h.aspectRatio}s.position.left=h.helper?n.left:0}if(m.top<(s._helper?n.top:0)){s.size.height=s.size.height+(s._helper?(s.position.top-n.top):s.position.top);if(q){s.size.width=s.size.height*h.aspectRatio}s.position.top=s._helper?n.top:0}s.offset.left=s.parentData.left+s.position.left;s.offset.top=s.parentData.top+s.position.top;var k=Math.abs((s._helper?s.offset.left-d.left:(s.offset.left-d.left))+s.sizeDiff.width),r=Math.abs((s._helper?s.offset.top-d.top:(s.offset.top-n.top))+s.sizeDiff.height);var j=s.containerElement.get(0)==s.element.parent().get(0),i=/relative|absolute/.test(s.containerElement.css("position"));if(j&&i){k-=s.parentData.left}if(k+s.size.width>=s.parentData.width){s.size.width=s.parentData.width-k;if(q){s.size.height=s.size.width/s.aspectRatio}}if(r+s.size.height>=s.parentData.height){s.size.height=s.parentData.height-r;if(q){s.size.width=s.size.height*s.aspectRatio}}},stop:function(e,m){var p=c(this).data("resizable"),f=p.options,k=p.position,l=p.containerOffset,d=p.containerPosition,g=p.containerElement;var i=c(p.helper),q=i.offset(),n=i.outerWidth()-p.sizeDiff.width,j=i.outerHeight()-p.sizeDiff.height;if(p._helper&&!f.animate&&(/relative/).test(g.css("position"))){c(this).css({left:q.left-d.left-l.left,width:n,height:j})}if(p._helper&&!f.animate&&(/static/).test(g.css("position"))){c(this).css({left:q.left-d.left-l.left,width:n,height:j})}}});c.ui.plugin.add("resizable","ghost",{start:function(f,g){var d=c(this).data("resizable"),h=d.options,e=d.size;d.ghost=d.originalElement.clone();d.ghost.css({opacity:0.25,display:"block",position:"relative",height:e.height,width:e.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass(typeof h.ghost=="string"?h.ghost:"");d.ghost.appendTo(d.helper)},resize:function(e,f){var d=c(this).data("resizable"),g=d.options;if(d.ghost){d.ghost.css({position:"relative",height:d.size.height,width:d.size.width})}},stop:function(e,f){var d=c(this).data("resizable"),g=d.options;if(d.ghost&&d.helper){d.helper.get(0).removeChild(d.ghost.get(0))}}});c.ui.plugin.add("resizable","grid",{resize:function(d,l){var n=c(this).data("resizable"),g=n.options,j=n.size,h=n.originalSize,i=n.originalPosition,m=n.axis,k=g._aspectRatio||d.shiftKey;g.grid=typeof g.grid=="number"?[g.grid,g.grid]:g.grid;var f=Math.round((j.width-h.width)/(g.grid[0]||1))*(g.grid[0]||1),e=Math.round((j.height-h.height)/(g.grid[1]||1))*(g.grid[1]||1);if(/^(se|s|e)$/.test(m)){n.size.width=h.width+f;n.size.height=h.height+e}else{if(/^(ne)$/.test(m)){n.size.width=h.width+f;n.size.height=h.height+e;n.position.top=i.top-e}else{if(/^(sw)$/.test(m)){n.size.width=h.width+f;n.size.height=h.height+e;n.position.left=i.left-f}else{n.size.width=h.width+f;n.size.height=h.height+e;n.position.top=i.top-e;n.position.left=i.left-f}}}}});var b=function(d){return parseInt(d,10)||0};var a=function(d){return !isNaN(parseInt(d,10))}})(jQuery);;/*
- * jQuery UI Selectable 1.7.1
- *
- * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT (MIT-LICENSE.txt)
- * and GPL (GPL-LICENSE.txt) licenses.
- *
- * http://docs.jquery.com/UI/Selectables
- *
- * Depends:
- * ui.core.js
- */
(function(a){a.widget("ui.selectable",a.extend({},a.ui.mouse,{_init:function(){var b=this;this.element.addClass("ui-selectable");this.dragged=false;var c;this.refresh=function(){c=a(b.options.filter,b.element[0]);c.each(function(){var d=a(this);var e=d.offset();a.data(this,"selectable-item",{element:this,$element:d,left:e.left,top:e.top,right:e.left+d.outerWidth(),bottom:e.top+d.outerHeight(),startselected:false,selected:d.hasClass("ui-selected"),selecting:d.hasClass("ui-selecting"),unselecting:d.hasClass("ui-unselecting")})})};this.refresh();this.selectees=c.addClass("ui-selectee");this._mouseInit();this.helper=a(document.createElement("div")).css({border:"1px dotted black"}).addClass("ui-selectable-helper")},destroy:function(){this.element.removeClass("ui-selectable ui-selectable-disabled").removeData("selectable").unbind(".selectable");this._mouseDestroy()},_mouseStart:function(d){var b=this;this.opos=[d.pageX,d.pageY];if(this.options.disabled){return}var c=this.options;this.selectees=a(c.filter,this.element[0]);this._trigger("start",d);a(c.appendTo).append(this.helper);this.helper.css({"z-index":100,position:"absolute",left:d.clientX,top:d.clientY,width:0,height:0});if(c.autoRefresh){this.refresh()}this.selectees.filter(".ui-selected").each(function(){var e=a.data(this,"selectable-item");e.startselected=true;if(!d.metaKey){e.$element.removeClass("ui-selected");e.selected=false;e.$element.addClass("ui-unselecting");e.unselecting=true;b._trigger("unselecting",d,{unselecting:e.element})}});a(d.target).parents().andSelf().each(function(){var e=a.data(this,"selectable-item");if(e){e.$element.removeClass("ui-unselecting").addClass("ui-selecting");e.unselecting=false;e.selecting=true;e.selected=true;b._trigger("selecting",d,{selecting:e.element});return false}})},_mouseDrag:function(i){var c=this;this.dragged=true;if(this.options.disabled){return}var e=this.options;var d=this.opos[0],h=this.opos[1],b=i.pageX,g=i.pageY;if(d>b){var f=b;b=d;d=f}if(h>g){var f=g;g=h;h=f}this.helper.css({left:d,top:h,width:b-d,height:g-h});this.selectees.each(function(){var j=a.data(this,"selectable-item");if(!j||j.element==c.element[0]){return}var k=false;if(e.tolerance=="touch"){k=(!(j.left>b||j.right<d||j.top>g||j.bottom<h))}else{if(e.tolerance=="fit"){k=(j.left>d&&j.right<b&&j.top>h&&j.bottom<g)}}if(k){if(j.selected){j.$element.removeClass("ui-selected");j.selected=false}if(j.unselecting){j.$element.removeClass("ui-unselecting");j.unselecting=false}if(!j.selecting){j.$element.addClass("ui-selecting");j.selecting=true;c._trigger("selecting",i,{selecting:j.element})}}else{if(j.selecting){if(i.metaKey&&j.startselected){j.$element.removeClass("ui-selecting");j.selecting=false;j.$element.addClass("ui-selected");j.selected=true}else{j.$element.removeClass("ui-selecting");j.selecting=false;if(j.startselected){j.$element.addClass("ui-unselecting");j.unselecting=true}c._trigger("unselecting",i,{unselecting:j.element})}}if(j.selected){if(!i.metaKey&&!j.startselected){j.$element.removeClass("ui-selected");j.selected=false;j.$element.addClass("ui-unselecting");j.unselecting=true;c._trigger("unselecting",i,{unselecting:j.element})}}}});return false},_mouseStop:function(d){var b=this;this.dragged=false;var c=this.options;a(".ui-unselecting",this.element[0]).each(function(){var e=a.data(this,"selectable-item");e.$element.removeClass("ui-unselecting");e.unselecting=false;e.startselected=false;b._trigger("unselected",d,{unselected:e.element})});a(".ui-selecting",this.element[0]).each(function(){var e=a.data(this,"selectable-item");e.$element.removeClass("ui-selecting").addClass("ui-selected");e.selecting=false;e.selected=true;e.startselected=true;b._trigger("selected",d,{selected:e.element})});this._trigger("stop",d);this.helper.remove();return false}}));a.extend(a.ui.selectable,{version:"1.7.1",defaults:{appendTo:"body",autoRefresh:true,cancel:":input,option",delay:0,distance:0,filter:"*",tolerance:"touch"}})})(jQuery);;/*
- * jQuery UI Sortable 1.7.1
- *
- * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT (MIT-LICENSE.txt)
- * and GPL (GPL-LICENSE.txt) licenses.
- *
- * http://docs.jquery.com/UI/Sortables
- *
- * Depends:
- * ui.core.js
- */
(function(a){a.widget("ui.sortable",a.extend({},a.ui.mouse,{_init:function(){var b=this.options;this.containerCache={};this.element.addClass("ui-sortable");this.refresh();this.floating=this.items.length?(/left|right/).test(this.items[0].item.css("float")):false;this.offset=this.element.offset();this._mouseInit()},destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled").removeData("sortable").unbind(".sortable");this._mouseDestroy();for(var b=this.items.length-1;b>=0;b--){this.items[b].item.removeData("sortable-item")}},_mouseCapture:function(e,f){if(this.reverting){return false}if(this.options.disabled||this.options.type=="static"){return false}this._refreshItems(e);var d=null,c=this,b=a(e.target).parents().each(function(){if(a.data(this,"sortable-item")==c){d=a(this);return false}});if(a.data(e.target,"sortable-item")==c){d=a(e.target)}if(!d){return false}if(this.options.handle&&!f){var g=false;a(this.options.handle,d).find("*").andSelf().each(function(){if(this==e.target){g=true}});if(!g){return false}}this.currentItem=d;this._removeCurrentsFromItems();return true},_mouseStart:function(e,f,b){var g=this.options,c=this;this.currentContainer=this;this.refreshPositions();this.helper=this._createHelper(e);this._cacheHelperProportions();this._cacheMargins();this.scrollParent=this.helper.scrollParent();this.offset=this.currentItem.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};this.helper.css("position","absolute");this.cssPosition=this.helper.css("position");a.extend(this.offset,{click:{left:e.pageX-this.offset.left,top:e.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this._generatePosition(e);this.originalPageX=e.pageX;this.originalPageY=e.pageY;if(g.cursorAt){this._adjustOffsetFromHelper(g.cursorAt)}this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]};if(this.helper[0]!=this.currentItem[0]){this.currentItem.hide()}this._createPlaceholder();if(g.containment){this._setContainment()}if(g.cursor){if(a("body").css("cursor")){this._storedCursor=a("body").css("cursor")}a("body").css("cursor",g.cursor)}if(g.opacity){if(this.helper.css("opacity")){this._storedOpacity=this.helper.css("opacity")}this.helper.css("opacity",g.opacity)}if(g.zIndex){if(this.helper.css("zIndex")){this._storedZIndex=this.helper.css("zIndex")}this.helper.css("zIndex",g.zIndex)}if(this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML"){this.overflowOffset=this.scrollParent.offset()}this._trigger("start",e,this._uiHash());if(!this._preserveHelperProportions){this._cacheHelperProportions()}if(!b){for(var d=this.containers.length-1;d>=0;d--){this.containers[d]._trigger("activate",e,c._uiHash(this))}}if(a.ui.ddmanager){a.ui.ddmanager.current=this}if(a.ui.ddmanager&&!g.dropBehaviour){a.ui.ddmanager.prepareOffsets(this,e)}this.dragging=true;this.helper.addClass("ui-sortable-helper");this._mouseDrag(e);return true},_mouseDrag:function(f){this.position=this._generatePosition(f);this.positionAbs=this._convertPositionTo("absolute");if(!this.lastPositionAbs){this.lastPositionAbs=this.positionAbs}if(this.options.scroll){var g=this.options,b=false;if(this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML"){if((this.overflowOffset.top+this.scrollParent[0].offsetHeight)-f.pageY<g.scrollSensitivity){this.scrollParent[0].scrollTop=b=this.scrollParent[0].scrollTop+g.scrollSpeed}else{if(f.pageY-this.overflowOffset.top<g.scrollSensitivity){this.scrollParent[0].scrollTop=b=this.scrollParent[0].scrollTop-g.scrollSpeed}}if((this.overflowOffset.left+this.scrollParent[0].offsetWidth)-f.pageX<g.scrollSensitivity){this.scrollParent[0].scrollLeft=b=this.scrollParent[0].scrollLeft+g.scrollSpeed}else{if(f.pageX-this.overflowOffset.left<g.scrollSensitivity){this.scrollParent[0].scrollLeft=b=this.scrollParent[0].scrollLeft-g.scrollSpeed}}}else{if(f.pageY-a(document).scrollTop()<g.scrollSensitivity){b=a(document).scrollTop(a(document).scrollTop()-g.scrollSpeed)}else{if(a(window).height()-(f.pageY-a(document).scrollTop())<g.scrollSensitivity){b=a(document).scrollTop(a(document).scrollTop()+g.scrollSpeed)}}if(f.pageX-a(document).scrollLeft()<g.scrollSensitivity){b=a(document).scrollLeft(a(document).scrollLeft()-g.scrollSpeed)}else{if(a(window).width()-(f.pageX-a(document).scrollLeft())<g.scrollSensitivity){b=a(document).scrollLeft(a(document).scrollLeft()+g.scrollSpeed)}}}if(b!==false&&a.ui.ddmanager&&!g.dropBehaviour){a.ui.ddmanager.prepareOffsets(this,f)}}this.positionAbs=this._convertPositionTo("absolute");if(!this.options.axis||this.options.axis!="y"){this.helper[0].style.left=this.position.left+"px"}if(!this.options.axis||this.options.axis!="x"){this.helper[0].style.top=this.position.top+"px"}for(var d=this.items.length-1;d>=0;d--){var e=this.items[d],c=e.item[0],h=this._intersectsWithPointer(e);if(!h){continue}if(c!=this.currentItem[0]&&this.placeholder[h==1?"next":"prev"]()[0]!=c&&!a.ui.contains(this.placeholder[0],c)&&(this.options.type=="semi-dynamic"?!a.ui.contains(this.element[0],c):true)){this.direction=h==1?"down":"up";if(this.options.tolerance=="pointer"||this._intersectsWithSides(e)){this._rearrange(f,e)}else{break}this._trigger("change",f,this._uiHash());break}}this._contactContainers(f);if(a.ui.ddmanager){a.ui.ddmanager.drag(this,f)}this._trigger("sort",f,this._uiHash());this.lastPositionAbs=this.positionAbs;return false},_mouseStop:function(c,d){if(!c){return}if(a.ui.ddmanager&&!this.options.dropBehaviour){a.ui.ddmanager.drop(this,c)}if(this.options.revert){var b=this;var e=b.placeholder.offset();b.reverting=true;a(this.helper).animate({left:e.left-this.offset.parent.left-b.margins.left+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollLeft),top:e.top-this.offset.parent.top-b.margins.top+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollTop)},parseInt(this.options.revert,10)||500,function(){b._clear(c)})}else{this._clear(c,d)}return false},cancel:function(){var b=this;if(this.dragging){this._mouseUp();if(this.options.helper=="original"){this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else{this.currentItem.show()}for(var c=this.containers.length-1;c>=0;c--){this.containers[c]._trigger("deactivate",null,b._uiHash(this));if(this.containers[c].containerCache.over){this.containers[c]._trigger("out",null,b._uiHash(this));this.containers[c].containerCache.over=0}}}if(this.placeholder[0].parentNode){this.placeholder[0].parentNode.removeChild(this.placeholder[0])}if(this.options.helper!="original"&&this.helper&&this.helper[0].parentNode){this.helper.remove()}a.extend(this,{helper:null,dragging:false,reverting:false,_noFinalSort:null});if(this.domPosition.prev){a(this.domPosition.prev).after(this.currentItem)}else{a(this.domPosition.parent).prepend(this.currentItem)}return true},serialize:function(d){var b=this._getItemsAsjQuery(d&&d.connected);var c=[];d=d||{};a(b).each(function(){var e=(a(d.item||this).attr(d.attribute||"id")||"").match(d.expression||(/(.+)[-=_](.+)/));if(e){c.push((d.key||e[1]+"[]")+"="+(d.key&&d.expression?e[1]:e[2]))}});return c.join("&")},toArray:function(d){var b=this._getItemsAsjQuery(d&&d.connected);var c=[];d=d||{};b.each(function(){c.push(a(d.item||this).attr(d.attribute||"id")||"")});return c},_intersectsWith:function(m){var e=this.positionAbs.left,d=e+this.helperProportions.width,k=this.positionAbs.top,j=k+this.helperProportions.height;var f=m.left,c=f+m.width,n=m.top,i=n+m.height;var o=this.offset.click.top,h=this.offset.click.left;var g=(k+o)>n&&(k+o)<i&&(e+h)>f&&(e+h)<c;if(this.options.tolerance=="pointer"||this.options.forcePointerForContainers||(this.options.tolerance!="pointer"&&this.helperProportions[this.floating?"width":"height"]>m[this.floating?"width":"height"])){return g}else{return(f<e+(this.helperProportions.width/2)&&d-(this.helperProportions.width/2)<c&&n<k+(this.helperProportions.height/2)&&j-(this.helperProportions.height/2)<i)}},_intersectsWithPointer:function(d){var e=a.ui.isOverAxis(this.positionAbs.top+this.offset.click.top,d.top,d.height),c=a.ui.isOverAxis(this.positionAbs.left+this.offset.click.left,d.left,d.width),g=e&&c,b=this._getDragVerticalDirection(),f=this._getDragHorizontalDirection();if(!g){return false}return this.floating?(((f&&f=="right")||b=="down")?2:1):(b&&(b=="down"?2:1))},_intersectsWithSides:function(e){var c=a.ui.isOverAxis(this.positionAbs.top+this.offset.click.top,e.top+(e.height/2),e.height),d=a.ui.isOverAxis(this.positionAbs.left+this.offset.click.left,e.left+(e.width/2),e.width),b=this._getDragVerticalDirection(),f=this._getDragHorizontalDirection();if(this.floating&&f){return((f=="right"&&d)||(f=="left"&&!d))}else{return b&&((b=="down"&&c)||(b=="up"&&!c))}},_getDragVerticalDirection:function(){var b=this.positionAbs.top-this.lastPositionAbs.top;return b!=0&&(b>0?"down":"up")},_getDragHorizontalDirection:function(){var b=this.positionAbs.left-this.lastPositionAbs.left;return b!=0&&(b>0?"right":"left")},refresh:function(b){this._refreshItems(b);this.refreshPositions()},_connectWith:function(){var b=this.options;return b.connectWith.constructor==String?[b.connectWith]:b.connectWith},_getItemsAsjQuery:function(b){var l=this;var g=[];var e=[];var h=this._connectWith();if(h&&b){for(var d=h.length-1;d>=0;d--){var k=a(h[d]);for(var c=k.length-1;c>=0;c--){var f=a.data(k[c],"sortable");if(f&&f!=this&&!f.options.disabled){e.push([a.isFunction(f.options.items)?f.options.items.call(f.element):a(f.options.items,f.element).not(".ui-sortable-helper"),f])}}}}e.push([a.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):a(this.options.items,this.element).not(".ui-sortable-helper"),this]);for(var d=e.length-1;d>=0;d--){e[d][0].each(function(){g.push(this)})}return a(g)},_removeCurrentsFromItems:function(){var d=this.currentItem.find(":data(sortable-item)");for(var c=0;c<this.items.length;c++){for(var b=0;b<d.length;b++){if(d[b]==this.items[c].item[0]){this.items.splice(c,1)}}}},_refreshItems:function(b){this.items=[];this.containers=[this];var h=this.items;var p=this;var f=[[a.isFunction(this.options.items)?this.options.items.call(this.element[0],b,{item:this.currentItem}):a(this.options.items,this.element),this]];var l=this._connectWith();if(l){for(var e=l.length-1;e>=0;e--){var m=a(l[e]);for(var d=m.length-1;d>=0;d--){var g=a.data(m[d],"sortable");if(g&&g!=this&&!g.options.disabled){f.push([a.isFunction(g.options.items)?g.options.items.call(g.element[0],b,{item:this.currentItem}):a(g.options.items,g.element),g]);this.containers.push(g)}}}}for(var e=f.length-1;e>=0;e--){var k=f[e][1];var c=f[e][0];for(var d=0,n=c.length;d<n;d++){var o=a(c[d]);o.data("sortable-item",k);h.push({item:o,instance:k,width:0,height:0,left:0,top:0})}}},refreshPositions:function(b){if(this.offsetParent&&this.helper){this.offset.parent=this._getParentOffset()}for(var d=this.items.length-1;d>=0;d--){var e=this.items[d];if(e.instance!=this.currentContainer&&this.currentContainer&&e.item[0]!=this.currentItem[0]){continue}var c=this.options.toleranceElement?a(this.options.toleranceElement,e.item):e.item;if(!b){e.width=c.outerWidth();e.height=c.outerHeight()}var f=c.offset();e.left=f.left;e.top=f.top}if(this.options.custom&&this.options.custom.refreshContainers){this.options.custom.refreshContainers.call(this)}else{for(var d=this.containers.length-1;d>=0;d--){var f=this.containers[d].element.offset();this.containers[d].containerCache.left=f.left;this.containers[d].containerCache.top=f.top;this.containers[d].containerCache.width=this.containers[d].element.outerWidth();this.containers[d].containerCache.height=this.containers[d].element.outerHeight()}}},_createPlaceholder:function(d){var b=d||this,e=b.options;if(!e.placeholder||e.placeholder.constructor==String){var c=e.placeholder;e.placeholder={element:function(){var f=a(document.createElement(b.currentItem[0].nodeName)).addClass(c||b.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper")[0];if(!c){f.style.visibility="hidden"}return f},update:function(f,g){if(c&&!e.forcePlaceholderSize){return}if(!g.height()){g.height(b.currentItem.innerHeight()-parseInt(b.currentItem.css("paddingTop")||0,10)-parseInt(b.currentItem.css("paddingBottom")||0,10))}if(!g.width()){g.width(b.currentItem.innerWidth()-parseInt(b.currentItem.css("paddingLeft")||0,10)-parseInt(b.currentItem.css("paddingRight")||0,10))}}}}b.placeholder=a(e.placeholder.element.call(b.element,b.currentItem));b.currentItem.after(b.placeholder);e.placeholder.update(b,b.placeholder)},_contactContainers:function(d){for(var c=this.containers.length-1;c>=0;c--){if(this._intersectsWith(this.containers[c].containerCache)){if(!this.containers[c].containerCache.over){if(this.currentContainer!=this.containers[c]){var h=10000;var g=null;var e=this.positionAbs[this.containers[c].floating?"left":"top"];for(var b=this.items.length-1;b>=0;b--){if(!a.ui.contains(this.containers[c].element[0],this.items[b].item[0])){continue}var f=this.items[b][this.containers[c].floating?"left":"top"];if(Math.abs(f-e)<h){h=Math.abs(f-e);g=this.items[b]}}if(!g&&!this.options.dropOnEmpty){continue}this.currentContainer=this.containers[c];g?this._rearrange(d,g,null,true):this._rearrange(d,null,this.containers[c].element,true);this._trigger("change",d,this._uiHash());this.containers[c]._trigger("change",d,this._uiHash(this));this.options.placeholder.update(this.currentContainer,this.placeholder)}this.containers[c]._trigger("over",d,this._uiHash(this));this.containers[c].containerCache.over=1}}else{if(this.containers[c].containerCache.over){this.containers[c]._trigger("out",d,this._uiHash(this));this.containers[c].containerCache.over=0}}}},_createHelper:function(c){var d=this.options;var b=a.isFunction(d.helper)?a(d.helper.apply(this.element[0],[c,this.currentItem])):(d.helper=="clone"?this.currentItem.clone():this.currentItem);if(!b.parents("body").length){a(d.appendTo!="parent"?d.appendTo:this.currentItem[0].parentNode)[0].appendChild(b[0])}if(b[0]==this.currentItem[0]){this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")}}if(b[0].style.width==""||d.forceHelperSize){b.width(this.currentItem.width())}if(b[0].style.height==""||d.forceHelperSize){b.height(this.currentItem.height())}return b},_adjustOffsetFromHelper:function(b){if(b.left!=undefined){this.offset.click.left=b.left+this.margins.left}if(b.right!=undefined){this.offset.click.left=this.helperProportions.width-b.right+this.margins.left}if(b.top!=undefined){this.offset.click.top=b.top+this.margins.top}if(b.bottom!=undefined){this.offset.click.top=this.helperProportions.height-b.bottom+this.margins.top}},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var b=this.offsetParent.offset();if(this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0])){b.left+=this.scrollParent.scrollLeft();b.top+=this.scrollParent.scrollTop()}if((this.offsetParent[0]==document.body)||(this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&a.browser.msie)){b={top:0,left:0}}return{top:b.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:b.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var b=this.currentItem.position();return{top:b.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:b.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}else{return{top:0,left:0}}},_cacheMargins:function(){this.margins={left:(parseInt(this.currentItem.css("marginLeft"),10)||0),top:(parseInt(this.currentItem.css("marginTop"),10)||0)}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var e=this.options;if(e.containment=="parent"){e.containment=this.helper[0].parentNode}if(e.containment=="document"||e.containment=="window"){this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,a(e.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(a(e.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]}if(!(/^(document|window|parent)$/).test(e.containment)){var c=a(e.containment)[0];var d=a(e.containment).offset();var b=(a(c).css("overflow")!="hidden");this.containment=[d.left+(parseInt(a(c).css("borderLeftWidth"),10)||0)+(parseInt(a(c).css("paddingLeft"),10)||0)-this.margins.left,d.top+(parseInt(a(c).css("borderTopWidth"),10)||0)+(parseInt(a(c).css("paddingTop"),10)||0)-this.margins.top,d.left+(b?Math.max(c.scrollWidth,c.offsetWidth):c.offsetWidth)-(parseInt(a(c).css("borderLeftWidth"),10)||0)-(parseInt(a(c).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,d.top+(b?Math.max(c.scrollHeight,c.offsetHeight):c.offsetHeight)-(parseInt(a(c).css("borderTopWidth"),10)||0)-(parseInt(a(c).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top]}},_convertPositionTo:function(f,h){if(!h){h=this.position}var c=f=="absolute"?1:-1;var e=this.options,b=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,g=(/(html|body)/i).test(b[0].tagName);return{top:(h.top+this.offset.relative.top*c+this.offset.parent.top*c-(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():(g?0:b.scrollTop()))*c)),left:(h.left+this.offset.relative.left*c+this.offset.parent.left*c-(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():g?0:b.scrollLeft())*c))}},_generatePosition:function(e){var h=this.options,b=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,i=(/(html|body)/i).test(b[0].tagName);if(this.cssPosition=="relative"&&!(this.scrollParent[0]!=document&&this.scrollParent[0]!=this.offsetParent[0])){this.offset.relative=this._getRelativeOffset()}var d=e.pageX;var c=e.pageY;if(this.originalPosition){if(this.containment){if(e.pageX-this.offset.click.left<this.containment[0]){d=this.containment[0]+this.offset.click.left}if(e.pageY-this.offset.click.top<this.containment[1]){c=this.containment[1]+this.offset.click.top}if(e.pageX-this.offset.click.left>this.containment[2]){d=this.containment[2]+this.offset.click.left}if(e.pageY-this.offset.click.top>this.containment[3]){c=this.containment[3]+this.offset.click.top}}if(h.grid){var g=this.originalPageY+Math.round((c-this.originalPageY)/h.grid[1])*h.grid[1];c=this.containment?(!(g-this.offset.click.top<this.containment[1]||g-this.offset.click.top>this.containment[3])?g:(!(g-this.offset.click.top<this.containment[1])?g-h.grid[1]:g+h.grid[1])):g;var f=this.originalPageX+Math.round((d-this.originalPageX)/h.grid[0])*h.grid[0];d=this.containment?(!(f-this.offset.click.left<this.containment[0]||f-this.offset.click.left>this.containment[2])?f:(!(f-this.offset.click.left<this.containment[0])?f-h.grid[0]:f+h.grid[0])):f}}return{top:(c-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():(i?0:b.scrollTop())))),left:(d-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():i?0:b.scrollLeft())))}},_rearrange:function(g,f,c,e){c?c[0].appendChild(this.placeholder[0]):f.item[0].parentNode.insertBefore(this.placeholder[0],(this.direction=="down"?f.item[0]:f.item[0].nextSibling));this.counter=this.counter?++this.counter:1;var d=this,b=this.counter;window.setTimeout(function(){if(b==d.counter){d.refreshPositions(!e)}},0)},_clear:function(d,e){this.reverting=false;var f=[],b=this;if(!this._noFinalSort&&this.currentItem[0].parentNode){this.placeholder.before(this.currentItem)}this._noFinalSort=null;if(this.helper[0]==this.currentItem[0]){for(var c in this._storedCSS){if(this._storedCSS[c]=="auto"||this._storedCSS[c]=="static"){this._storedCSS[c]=""}}this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else{this.currentItem.show()}if(this.fromOutside&&!e){f.push(function(g){this._trigger("receive",g,this._uiHash(this.fromOutside))})}if((this.fromOutside||this.domPosition.prev!=this.currentItem.prev().not(".ui-sortable-helper")[0]||this.domPosition.parent!=this.currentItem.parent()[0])&&!e){f.push(function(g){this._trigger("update",g,this._uiHash())})}if(!a.ui.contains(this.element[0],this.currentItem[0])){if(!e){f.push(function(g){this._trigger("remove",g,this._uiHash())})}for(var c=this.containers.length-1;c>=0;c--){if(a.ui.contains(this.containers[c].element[0],this.currentItem[0])&&!e){f.push((function(g){return function(h){g._trigger("receive",h,this._uiHash(this))}}).call(this,this.containers[c]));f.push((function(g){return function(h){g._trigger("update",h,this._uiHash(this))}}).call(this,this.containers[c]))}}}for(var c=this.containers.length-1;c>=0;c--){if(!e){f.push((function(g){return function(h){g._trigger("deactivate",h,this._uiHash(this))}}).call(this,this.containers[c]))}if(this.containers[c].containerCache.over){f.push((function(g){return function(h){g._trigger("out",h,this._uiHash(this))}}).call(this,this.containers[c]));this.containers[c].containerCache.over=0}}if(this._storedCursor){a("body").css("cursor",this._storedCursor)}if(this._storedOpacity){this.helper.css("opacity",this._storedOpacity)}if(this._storedZIndex){this.helper.css("zIndex",this._storedZIndex=="auto"?"":this._storedZIndex)}this.dragging=false;if(this.cancelHelperRemoval){if(!e){this._trigger("beforeStop",d,this._uiHash());for(var c=0;c<f.length;c++){f[c].call(this,d)}this._trigger("stop",d,this._uiHash())}return false}if(!e){this._trigger("beforeStop",d,this._uiHash())}this.placeholder[0].parentNode.removeChild(this.placeholder[0]);if(this.helper[0]!=this.currentItem[0]){this.helper.remove()}this.helper=null;if(!e){for(var c=0;c<f.length;c++){f[c].call(this,d)}this._trigger("stop",d,this._uiHash())}this.fromOutside=false;return true},_trigger:function(){if(a.widget.prototype._trigger.apply(this,arguments)===false){this.cancel()}},_uiHash:function(c){var b=c||this;return{helper:b.helper,placeholder:b.placeholder||a([]),position:b.position,absolutePosition:b.positionAbs,offset:b.positionAbs,item:b.currentItem,sender:c?c.element:null}}}));a.extend(a.ui.sortable,{getter:"serialize toArray",version:"1.7.1",eventPrefix:"sort",defaults:{appendTo:"parent",axis:false,cancel:":input,option",connectWith:false,containment:false,cursor:"auto",cursorAt:false,delay:0,distance:1,dropOnEmpty:true,forcePlaceholderSize:false,forceHelperSize:false,grid:false,handle:false,helper:"original",items:"> *",opacity:false,placeholder:false,revert:false,scroll:true,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1000}})})(jQuery);;/*
- * jQuery UI Accordion 1.7.1
- *
- * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT (MIT-LICENSE.txt)
- * and GPL (GPL-LICENSE.txt) licenses.
- *
- * http://docs.jquery.com/UI/Accordion
- *
- * Depends:
- * ui.core.js
- */
(function(a){a.widget("ui.accordion",{_init:function(){var d=this.options,b=this;this.running=0;if(d.collapsible==a.ui.accordion.defaults.collapsible&&d.alwaysOpen!=a.ui.accordion.defaults.alwaysOpen){d.collapsible=!d.alwaysOpen}if(d.navigation){var c=this.element.find("a").filter(d.navigationFilter);if(c.length){if(c.filter(d.header).length){this.active=c}else{this.active=c.parent().parent().prev();c.addClass("ui-accordion-content-active")}}}this.element.addClass("ui-accordion ui-widget ui-helper-reset");if(this.element[0].nodeName=="UL"){this.element.children("li").addClass("ui-accordion-li-fix")}this.headers=this.element.find(d.header).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all").bind("mouseenter.accordion",function(){a(this).addClass("ui-state-hover")}).bind("mouseleave.accordion",function(){a(this).removeClass("ui-state-hover")}).bind("focus.accordion",function(){a(this).addClass("ui-state-focus")}).bind("blur.accordion",function(){a(this).removeClass("ui-state-focus")});this.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom");this.active=this._findActive(this.active||d.active).toggleClass("ui-state-default").toggleClass("ui-state-active").toggleClass("ui-corner-all").toggleClass("ui-corner-top");this.active.next().addClass("ui-accordion-content-active");a("<span/>").addClass("ui-icon "+d.icons.header).prependTo(this.headers);this.active.find(".ui-icon").toggleClass(d.icons.header).toggleClass(d.icons.headerSelected);if(a.browser.msie){this.element.find("a").css("zoom","1")}this.resize();this.element.attr("role","tablist");this.headers.attr("role","tab").bind("keydown",function(e){return b._keydown(e)}).next().attr("role","tabpanel");this.headers.not(this.active||"").attr("aria-expanded","false").attr("tabIndex","-1").next().hide();if(!this.active.length){this.headers.eq(0).attr("tabIndex","0")}else{this.active.attr("aria-expanded","true").attr("tabIndex","0")}if(!a.browser.safari){this.headers.find("a").attr("tabIndex","-1")}if(d.event){this.headers.bind((d.event)+".accordion",function(e){return b._clickHandler.call(b,e,this)})}},destroy:function(){var c=this.options;this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role").unbind(".accordion").removeData("accordion");this.headers.unbind(".accordion").removeClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-corner-top").removeAttr("role").removeAttr("aria-expanded").removeAttr("tabindex");this.headers.find("a").removeAttr("tabindex");this.headers.children(".ui-icon").remove();var b=this.headers.next().css("display","").removeAttr("role").removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active");if(c.autoHeight||c.fillHeight){b.css("height","")}},_setData:function(b,c){if(b=="alwaysOpen"){b="collapsible";c=!c}a.widget.prototype._setData.apply(this,arguments)},_keydown:function(e){var g=this.options,f=a.ui.keyCode;if(g.disabled||e.altKey||e.ctrlKey){return}var d=this.headers.length;var b=this.headers.index(e.target);var c=false;switch(e.keyCode){case f.RIGHT:case f.DOWN:c=this.headers[(b+1)%d];break;case f.LEFT:case f.UP:c=this.headers[(b-1+d)%d];break;case f.SPACE:case f.ENTER:return this._clickHandler({target:e.target},e.target)}if(c){a(e.target).attr("tabIndex","-1");a(c).attr("tabIndex","0");c.focus();return false}return true},resize:function(){var e=this.options,d;if(e.fillSpace){if(a.browser.msie){var b=this.element.parent().css("overflow");this.element.parent().css("overflow","hidden")}d=this.element.parent().height();if(a.browser.msie){this.element.parent().css("overflow",b)}this.headers.each(function(){d-=a(this).outerHeight()});var c=0;this.headers.next().each(function(){c=Math.max(c,a(this).innerHeight()-a(this).height())}).height(Math.max(0,d-c)).css("overflow","auto")}else{if(e.autoHeight){d=0;this.headers.next().each(function(){d=Math.max(d,a(this).outerHeight())}).height(d)}}},activate:function(b){var c=this._findActive(b)[0];this._clickHandler({target:c},c)},_findActive:function(b){return b?typeof b=="number"?this.headers.filter(":eq("+b+")"):this.headers.not(this.headers.not(b)):b===false?a([]):this.headers.filter(":eq(0)")},_clickHandler:function(b,f){var d=this.options;if(d.disabled){return false}if(!b.target&&d.collapsible){this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").find(".ui-icon").removeClass(d.icons.headerSelected).addClass(d.icons.header);this.active.next().addClass("ui-accordion-content-active");var h=this.active.next(),e={options:d,newHeader:a([]),oldHeader:d.active,newContent:a([]),oldContent:h},c=(this.active=a([]));this._toggle(c,h,e);return false}var g=a(b.currentTarget||f);var i=g[0]==this.active[0];if(this.running||(!d.collapsible&&i)){return false}this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").find(".ui-icon").removeClass(d.icons.headerSelected).addClass(d.icons.header);this.active.next().addClass("ui-accordion-content-active");if(!i){g.removeClass("ui-state-default ui-corner-all").addClass("ui-state-active ui-corner-top").find(".ui-icon").removeClass(d.icons.header).addClass(d.icons.headerSelected);g.next().addClass("ui-accordion-content-active")}var c=g.next(),h=this.active.next(),e={options:d,newHeader:i&&d.collapsible?a([]):g,oldHeader:this.active,newContent:i&&d.collapsible?a([]):c.find("> *"),oldContent:h.find("> *")},j=this.headers.index(this.active[0])>this.headers.index(g[0]);this.active=i?a([]):g;this._toggle(c,h,e,i,j);return false},_toggle:function(b,i,g,j,k){var d=this.options,m=this;this.toShow=b;this.toHide=i;this.data=g;var c=function(){if(!m){return}return m._completed.apply(m,arguments)};this._trigger("changestart",null,this.data);this.running=i.size()===0?b.size():i.size();if(d.animated){var f={};if(d.collapsible&&j){f={toShow:a([]),toHide:i,complete:c,down:k,autoHeight:d.autoHeight||d.fillSpace}}else{f={toShow:b,toHide:i,complete:c,down:k,autoHeight:d.autoHeight||d.fillSpace}}if(!d.proxied){d.proxied=d.animated}if(!d.proxiedDuration){d.proxiedDuration=d.duration}d.animated=a.isFunction(d.proxied)?d.proxied(f):d.proxied;d.duration=a.isFunction(d.proxiedDuration)?d.proxiedDuration(f):d.proxiedDuration;var l=a.ui.accordion.animations,e=d.duration,h=d.animated;if(!l[h]){l[h]=function(n){this.slide(n,{easing:h,duration:e||700})}}l[h](f)}else{if(d.collapsible&&j){b.toggle()}else{i.hide();b.show()}c(true)}i.prev().attr("aria-expanded","false").attr("tabIndex","-1").blur();b.prev().attr("aria-expanded","true").attr("tabIndex","0").focus()},_completed:function(b){var c=this.options;this.running=b?0:--this.running;if(this.running){return}if(c.clearStyle){this.toShow.add(this.toHide).css({height:"",overflow:""})}this._trigger("change",null,this.data)}});a.extend(a.ui.accordion,{version:"1.7.1",defaults:{active:null,alwaysOpen:true,animated:"slide",autoHeight:true,clearStyle:false,collapsible:false,event:"click",fillSpace:false,header:"> li > :first-child,> :not(li):even",icons:{header:"ui-icon-triangle-1-e",headerSelected:"ui-icon-triangle-1-s"},navigation:false,navigationFilter:function(){return this.href.toLowerCase()==location.href.toLowerCase()}},animations:{slide:function(j,h){j=a.extend({easing:"swing",duration:300},j,h);if(!j.toHide.size()){j.toShow.animate({height:"show"},j);return}if(!j.toShow.size()){j.toHide.animate({height:"hide"},j);return}var c=j.toShow.css("overflow"),g,d={},f={},e=["height","paddingTop","paddingBottom"],b;var i=j.toShow;b=i[0].style.width;i.width(parseInt(i.parent().width(),10)-parseInt(i.css("paddingLeft"),10)-parseInt(i.css("paddingRight"),10)-(parseInt(i.css("borderLeftWidth"),10)||0)-(parseInt(i.css("borderRightWidth"),10)||0));a.each(e,function(k,m){f[m]="hide";var l=(""+a.css(j.toShow[0],m)).match(/^([\d+-.]+)(.*)$/);d[m]={value:l[1],unit:l[2]||"px"}});j.toShow.css({height:0,overflow:"hidden"}).show();j.toHide.filter(":hidden").each(j.complete).end().filter(":visible").animate(f,{step:function(k,l){if(l.prop=="height"){g=(l.now-l.start)/(l.end-l.start)}j.toShow[0].style[l.prop]=(g*d[l.prop].value)+d[l.prop].unit},duration:j.duration,easing:j.easing,complete:function(){if(!j.autoHeight){j.toShow.css("height","")}j.toShow.css("width",b);j.toShow.css({overflow:c});j.complete()}})},bounceslide:function(b){this.slide(b,{easing:b.down?"easeOutBounce":"swing",duration:b.down?1000:200})},easeslide:function(b){this.slide(b,{easing:"easeinout",duration:700})}}})})(jQuery);;/*
- * jQuery UI Dialog 1.7.1
- *
- * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT (MIT-LICENSE.txt)
- * and GPL (GPL-LICENSE.txt) licenses.
- *
- * http://docs.jquery.com/UI/Dialog
- *
- * Depends:
- * ui.core.js
- * ui.draggable.js
- * ui.resizable.js
- */
(function(c){var b={dragStart:"start.draggable",drag:"drag.draggable",dragStop:"stop.draggable",maxHeight:"maxHeight.resizable",minHeight:"minHeight.resizable",maxWidth:"maxWidth.resizable",minWidth:"minWidth.resizable",resizeStart:"start.resizable",resize:"drag.resizable",resizeStop:"stop.resizable"},a="ui-dialog ui-widget ui-widget-content ui-corner-all ";c.widget("ui.dialog",{_init:function(){this.originalTitle=this.element.attr("title");var l=this,m=this.options,j=m.title||this.originalTitle||" ",e=c.ui.dialog.getTitleId(this.element),k=(this.uiDialog=c("<div/>")).appendTo(document.body).hide().addClass(a+m.dialogClass).css({position:"absolute",overflow:"hidden",zIndex:m.zIndex}).attr("tabIndex",-1).css("outline",0).keydown(function(n){(m.closeOnEscape&&n.keyCode&&n.keyCode==c.ui.keyCode.ESCAPE&&l.close(n))}).attr({role:"dialog","aria-labelledby":e}).mousedown(function(n){l.moveToTop(false,n)}),g=this.element.show().removeAttr("title").addClass("ui-dialog-content ui-widget-content").appendTo(k),f=(this.uiDialogTitlebar=c("<div></div>")).addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix").prependTo(k),i=c('<a href="#"/>').addClass("ui-dialog-titlebar-close ui-corner-all").attr("role","button").hover(function(){i.addClass("ui-state-hover")},function(){i.removeClass("ui-state-hover")}).focus(function(){i.addClass("ui-state-focus")}).blur(function(){i.removeClass("ui-state-focus")}).mousedown(function(n){n.stopPropagation()}).click(function(n){l.close(n);return false}).appendTo(f),h=(this.uiDialogTitlebarCloseText=c("<span/>")).addClass("ui-icon ui-icon-closethick").text(m.closeText).appendTo(i),d=c("<span/>").addClass("ui-dialog-title").attr("id",e).html(j).prependTo(f);f.find("*").add(f).disableSelection();(m.draggable&&c.fn.draggable&&this._makeDraggable());(m.resizable&&c.fn.resizable&&this._makeResizable());this._createButtons(m.buttons);this._isOpen=false;(m.bgiframe&&c.fn.bgiframe&&k.bgiframe());(m.autoOpen&&this.open())},destroy:function(){(this.overlay&&this.overlay.destroy());this.uiDialog.hide();this.element.unbind(".dialog").removeData("dialog").removeClass("ui-dialog-content ui-widget-content").hide().appendTo("body");this.uiDialog.remove();(this.originalTitle&&this.element.attr("title",this.originalTitle))},close:function(e){var d=this;if(false===d._trigger("beforeclose",e)){return}(d.overlay&&d.overlay.destroy());d.uiDialog.unbind("keypress.ui-dialog");(d.options.hide?d.uiDialog.hide(d.options.hide,function(){d._trigger("close",e)}):d.uiDialog.hide()&&d._trigger("close",e));c.ui.dialog.overlay.resize();d._isOpen=false},isOpen:function(){return this._isOpen},moveToTop:function(f,e){if((this.options.modal&&!f)||(!this.options.stack&&!this.options.modal)){return this._trigger("focus",e)}if(this.options.zIndex>c.ui.dialog.maxZ){c.ui.dialog.maxZ=this.options.zIndex}(this.overlay&&this.overlay.$el.css("z-index",c.ui.dialog.overlay.maxZ=++c.ui.dialog.maxZ));var d={scrollTop:this.element.attr("scrollTop"),scrollLeft:this.element.attr("scrollLeft")};this.uiDialog.css("z-index",++c.ui.dialog.maxZ);this.element.attr(d);this._trigger("focus",e)},open:function(){if(this._isOpen){return}var e=this.options,d=this.uiDialog;this.overlay=e.modal?new c.ui.dialog.overlay(this):null;(d.next().length&&d.appendTo("body"));this._size();this._position(e.position);d.show(e.show);this.moveToTop(true);(e.modal&&d.bind("keypress.ui-dialog",function(h){if(h.keyCode!=c.ui.keyCode.TAB){return}var g=c(":tabbable",this),i=g.filter(":first")[0],f=g.filter(":last")[0];if(h.target==f&&!h.shiftKey){setTimeout(function(){i.focus()},1)}else{if(h.target==i&&h.shiftKey){setTimeout(function(){f.focus()},1)}}}));c([]).add(d.find(".ui-dialog-content :tabbable:first")).add(d.find(".ui-dialog-buttonpane :tabbable:first")).add(d).filter(":first").focus();this._trigger("open");this._isOpen=true},_createButtons:function(g){var f=this,d=false,e=c("<div></div>").addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix");this.uiDialog.find(".ui-dialog-buttonpane").remove();(typeof g=="object"&&g!==null&&c.each(g,function(){return !(d=true)}));if(d){c.each(g,function(h,i){c('<button type="button"></button>').addClass("ui-state-default ui-corner-all").text(h).click(function(){i.apply(f.element[0],arguments)}).hover(function(){c(this).addClass("ui-state-hover")},function(){c(this).removeClass("ui-state-hover")}).focus(function(){c(this).addClass("ui-state-focus")}).blur(function(){c(this).removeClass("ui-state-focus")}).appendTo(e)});e.appendTo(this.uiDialog)}},_makeDraggable:function(){var d=this,f=this.options,e;this.uiDialog.draggable({cancel:".ui-dialog-content",handle:".ui-dialog-titlebar",containment:"document",start:function(){e=f.height;c(this).height(c(this).height()).addClass("ui-dialog-dragging");(f.dragStart&&f.dragStart.apply(d.element[0],arguments))},drag:function(){(f.drag&&f.drag.apply(d.element[0],arguments))},stop:function(){c(this).removeClass("ui-dialog-dragging").height(e);(f.dragStop&&f.dragStop.apply(d.element[0],arguments));c.ui.dialog.overlay.resize()}})},_makeResizable:function(g){g=(g===undefined?this.options.resizable:g);var d=this,f=this.options,e=typeof g=="string"?g:"n,e,s,w,se,sw,ne,nw";this.uiDialog.resizable({cancel:".ui-dialog-content",alsoResize:this.element,maxWidth:f.maxWidth,maxHeight:f.maxHeight,minWidth:f.minWidth,minHeight:f.minHeight,start:function(){c(this).addClass("ui-dialog-resizing");(f.resizeStart&&f.resizeStart.apply(d.element[0],arguments))},resize:function(){(f.resize&&f.resize.apply(d.element[0],arguments))},handles:e,stop:function(){c(this).removeClass("ui-dialog-resizing");f.height=c(this).height();f.width=c(this).width();(f.resizeStop&&f.resizeStop.apply(d.element[0],arguments));c.ui.dialog.overlay.resize()}}).find(".ui-resizable-se").addClass("ui-icon ui-icon-grip-diagonal-se")},_position:function(i){var e=c(window),f=c(document),g=f.scrollTop(),d=f.scrollLeft(),h=g;if(c.inArray(i,["center","top","right","bottom","left"])>=0){i=[i=="right"||i=="left"?i:"center",i=="top"||i=="bottom"?i:"middle"]}if(i.constructor!=Array){i=["center","middle"]}if(i[0].constructor==Number){d+=i[0]}else{switch(i[0]){case"left":d+=0;break;case"right":d+=e.width()-this.uiDialog.outerWidth();break;default:case"center":d+=(e.width()-this.uiDialog.outerWidth())/2}}if(i[1].constructor==Number){g+=i[1]}else{switch(i[1]){case"top":g+=0;break;case"bottom":g+=e.height()-this.uiDialog.outerHeight();break;default:case"middle":g+=(e.height()-this.uiDialog.outerHeight())/2}}g=Math.max(g,h);this.uiDialog.css({top:g,left:d})},_setData:function(e,f){(b[e]&&this.uiDialog.data(b[e],f));switch(e){case"buttons":this._createButtons(f);break;case"closeText":this.uiDialogTitlebarCloseText.text(f);break;case"dialogClass":this.uiDialog.removeClass(this.options.dialogClass).addClass(a+f);break;case"draggable":(f?this._makeDraggable():this.uiDialog.draggable("destroy"));break;case"height":this.uiDialog.height(f);break;case"position":this._position(f);break;case"resizable":var d=this.uiDialog,g=this.uiDialog.is(":data(resizable)");(g&&!f&&d.resizable("destroy"));(g&&typeof f=="string"&&d.resizable("option","handles",f));(g||this._makeResizable(f));break;case"title":c(".ui-dialog-title",this.uiDialogTitlebar).html(f||" ");break;case"width":this.uiDialog.width(f);break}c.widget.prototype._setData.apply(this,arguments)},_size:function(){var e=this.options;this.element.css({height:0,minHeight:0,width:"auto"});var d=this.uiDialog.css({height:"auto",width:e.width}).height();this.element.css({minHeight:Math.max(e.minHeight-d,0),height:e.height=="auto"?"auto":Math.max(e.height-d,0)})}});c.extend(c.ui.dialog,{version:"1.7.1",defaults:{autoOpen:true,bgiframe:false,buttons:{},closeOnEscape:true,closeText:"close",dialogClass:"",draggable:true,hide:null,height:"auto",maxHeight:false,maxWidth:false,minHeight:150,minWidth:150,modal:false,position:"center",resizable:true,show:null,stack:true,title:"",width:300,zIndex:1000},getter:"isOpen",uuid:0,maxZ:0,getTitleId:function(d){return"ui-dialog-title-"+(d.attr("id")||++this.uuid)},overlay:function(d){this.$el=c.ui.dialog.overlay.create(d)}});c.extend(c.ui.dialog.overlay,{instances:[],maxZ:0,events:c.map("focus,mousedown,mouseup,keydown,keypress,click".split(","),function(d){return d+".dialog-overlay"}).join(" "),create:function(e){if(this.instances.length===0){setTimeout(function(){c(document).bind(c.ui.dialog.overlay.events,function(f){var g=c(f.target).parents(".ui-dialog").css("zIndex")||0;return(g>c.ui.dialog.overlay.maxZ)})},1);c(document).bind("keydown.dialog-overlay",function(f){(e.options.closeOnEscape&&f.keyCode&&f.keyCode==c.ui.keyCode.ESCAPE&&e.close(f))});c(window).bind("resize.dialog-overlay",c.ui.dialog.overlay.resize)}var d=c("<div></div>").appendTo(document.body).addClass("ui-widget-overlay").css({width:this.width(),height:this.height()});(e.options.bgiframe&&c.fn.bgiframe&&d.bgiframe());this.instances.push(d);return d},destroy:function(d){this.instances.splice(c.inArray(this.instances,d),1);if(this.instances.length===0){c([document,window]).unbind(".dialog-overlay")}d.remove()},height:function(){if(c.browser.msie&&c.browser.version<7){var e=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight);var d=Math.max(document.documentElement.offsetHeight,document.body.offsetHeight);if(e<d){return c(window).height()+"px"}else{return e+"px"}}else{return c(document).height()+"px"}},width:function(){if(c.browser.msie&&c.browser.version<7){var d=Math.max(document.documentElement.scrollWidth,document.body.scrollWidth);var e=Math.max(document.documentElement.offsetWidth,document.body.offsetWidth);if(d<e){return c(window).width()+"px"}else{return d+"px"}}else{return c(document).width()+"px"}},resize:function(){var d=c([]);c.each(c.ui.dialog.overlay.instances,function(){d=d.add(this)});d.css({width:0,height:0}).css({width:c.ui.dialog.overlay.width(),height:c.ui.dialog.overlay.height()})}});c.extend(c.ui.dialog.overlay.prototype,{destroy:function(){c.ui.dialog.overlay.destroy(this.$el)}})})(jQuery);;/*
- * jQuery UI Slider 1.7.1
- *
- * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT (MIT-LICENSE.txt)
- * and GPL (GPL-LICENSE.txt) licenses.
- *
- * http://docs.jquery.com/UI/Slider
- *
- * Depends:
- * ui.core.js
- */
(function(a){a.widget("ui.slider",a.extend({},a.ui.mouse,{_init:function(){var b=this,c=this.options;this._keySliding=false;this._handleIndex=null;this._detectOrientation();this._mouseInit();this.element.addClass("ui-slider ui-slider-"+this.orientation+" ui-widget ui-widget-content ui-corner-all");this.range=a([]);if(c.range){if(c.range===true){this.range=a("<div></div>");if(!c.values){c.values=[this._valueMin(),this._valueMin()]}if(c.values.length&&c.values.length!=2){c.values=[c.values[0],c.values[0]]}}else{this.range=a("<div></div>")}this.range.appendTo(this.element).addClass("ui-slider-range");if(c.range=="min"||c.range=="max"){this.range.addClass("ui-slider-range-"+c.range)}this.range.addClass("ui-widget-header")}if(a(".ui-slider-handle",this.element).length==0){a('<a href="#"></a>').appendTo(this.element).addClass("ui-slider-handle")}if(c.values&&c.values.length){while(a(".ui-slider-handle",this.element).length<c.values.length){a('<a href="#"></a>').appendTo(this.element).addClass("ui-slider-handle")}}this.handles=a(".ui-slider-handle",this.element).addClass("ui-state-default ui-corner-all");this.handle=this.handles.eq(0);this.handles.add(this.range).filter("a").click(function(d){d.preventDefault()}).hover(function(){a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")}).focus(function(){a(".ui-slider .ui-state-focus").removeClass("ui-state-focus");a(this).addClass("ui-state-focus")}).blur(function(){a(this).removeClass("ui-state-focus")});this.handles.each(function(d){a(this).data("index.ui-slider-handle",d)});this.handles.keydown(function(i){var f=true;var e=a(this).data("index.ui-slider-handle");if(b.options.disabled){return}switch(i.keyCode){case a.ui.keyCode.HOME:case a.ui.keyCode.END:case a.ui.keyCode.UP:case a.ui.keyCode.RIGHT:case a.ui.keyCode.DOWN:case a.ui.keyCode.LEFT:f=false;if(!b._keySliding){b._keySliding=true;a(this).addClass("ui-state-active");b._start(i,e)}break}var g,d,h=b._step();if(b.options.values&&b.options.values.length){g=d=b.values(e)}else{g=d=b.value()}switch(i.keyCode){case a.ui.keyCode.HOME:d=b._valueMin();break;case a.ui.keyCode.END:d=b._valueMax();break;case a.ui.keyCode.UP:case a.ui.keyCode.RIGHT:if(g==b._valueMax()){return}d=g+h;break;case a.ui.keyCode.DOWN:case a.ui.keyCode.LEFT:if(g==b._valueMin()){return}d=g-h;break}b._slide(i,e,d);return f}).keyup(function(e){var d=a(this).data("index.ui-slider-handle");if(b._keySliding){b._stop(e,d);b._change(e,d);b._keySliding=false;a(this).removeClass("ui-state-active")}});this._refreshValue()},destroy:function(){this.handles.remove();this.range.remove();this.element.removeClass("ui-slider ui-slider-horizontal ui-slider-vertical ui-slider-disabled ui-widget ui-widget-content ui-corner-all").removeData("slider").unbind(".slider");this._mouseDestroy()},_mouseCapture:function(d){var e=this.options;if(e.disabled){return false}this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()};this.elementOffset=this.element.offset();var h={x:d.pageX,y:d.pageY};var j=this._normValueFromMouse(h);var c=this._valueMax()-this._valueMin()+1,f;var k=this,i;this.handles.each(function(l){var m=Math.abs(j-k.values(l));if(c>m){c=m;f=a(this);i=l}});if(e.range==true&&this.values(1)==e.min){f=a(this.handles[++i])}this._start(d,i);k._handleIndex=i;f.addClass("ui-state-active").focus();var g=f.offset();var b=!a(d.target).parents().andSelf().is(".ui-slider-handle");this._clickOffset=b?{left:0,top:0}:{left:d.pageX-g.left-(f.width()/2),top:d.pageY-g.top-(f.height()/2)-(parseInt(f.css("borderTopWidth"),10)||0)-(parseInt(f.css("borderBottomWidth"),10)||0)+(parseInt(f.css("marginTop"),10)||0)};j=this._normValueFromMouse(h);this._slide(d,i,j);return true},_mouseStart:function(b){return true},_mouseDrag:function(d){var b={x:d.pageX,y:d.pageY};var c=this._normValueFromMouse(b);this._slide(d,this._handleIndex,c);return false},_mouseStop:function(b){this.handles.removeClass("ui-state-active");this._stop(b,this._handleIndex);this._change(b,this._handleIndex);this._handleIndex=null;this._clickOffset=null;return false},_detectOrientation:function(){this.orientation=this.options.orientation=="vertical"?"vertical":"horizontal"},_normValueFromMouse:function(d){var c,h;if("horizontal"==this.orientation){c=this.elementSize.width;h=d.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)}else{c=this.elementSize.height;h=d.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)}var f=(h/c);if(f>1){f=1}if(f<0){f=0}if("vertical"==this.orientation){f=1-f}var e=this._valueMax()-this._valueMin(),i=f*e,b=i%this.options.step,g=this._valueMin()+i-b;if(b>(this.options.step/2)){g+=this.options.step}return parseFloat(g.toFixed(5))},_start:function(d,c){var b={handle:this.handles[c],value:this.value()};if(this.options.values&&this.options.values.length){b.value=this.values(c);b.values=this.values()}this._trigger("start",d,b)},_slide:function(f,e,d){var g=this.handles[e];if(this.options.values&&this.options.values.length){var b=this.values(e?0:1);if((e==0&&d>=b)||(e==1&&d<=b)){d=b}if(d!=this.values(e)){var c=this.values();c[e]=d;var h=this._trigger("slide",f,{handle:this.handles[e],value:d,values:c});var b=this.values(e?0:1);if(h!==false){this.values(e,d,(f.type=="mousedown"&&this.options.animate),true)}}}else{if(d!=this.value()){var h=this._trigger("slide",f,{handle:this.handles[e],value:d});if(h!==false){this._setData("value",d,(f.type=="mousedown"&&this.options.animate))}}}},_stop:function(d,c){var b={handle:this.handles[c],value:this.value()};if(this.options.values&&this.options.values.length){b.value=this.values(c);b.values=this.values()}this._trigger("stop",d,b)},_change:function(d,c){var b={handle:this.handles[c],value:this.value()};if(this.options.values&&this.options.values.length){b.value=this.values(c);b.values=this.values()}this._trigger("change",d,b)},value:function(b){if(arguments.length){this._setData("value",b);this._change(null,0)}return this._value()},values:function(b,e,c,d){if(arguments.length>1){this.options.values[b]=e;this._refreshValue(c);if(!d){this._change(null,b)}}if(arguments.length){if(this.options.values&&this.options.values.length){return this._values(b)}else{return this.value()}}else{return this._values()}},_setData:function(b,d,c){a.widget.prototype._setData.apply(this,arguments);switch(b){case"orientation":this._detectOrientation();this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui-slider-"+this.orientation);this._refreshValue(c);break;case"value":this._refreshValue(c);break}},_step:function(){var b=this.options.step;return b},_value:function(){var b=this.options.value;if(b<this._valueMin()){b=this._valueMin()}if(b>this._valueMax()){b=this._valueMax()}return b},_values:function(b){if(arguments.length){var c=this.options.values[b];if(c<this._valueMin()){c=this._valueMin()}if(c>this._valueMax()){c=this._valueMax()}return c}else{return this.options.values}},_valueMin:function(){var b=this.options.min;return b},_valueMax:function(){var b=this.options.max;return b},_refreshValue:function(c){var f=this.options.range,d=this.options,l=this;if(this.options.values&&this.options.values.length){var i,h;this.handles.each(function(p,n){var o=(l.values(p)-l._valueMin())/(l._valueMax()-l._valueMin())*100;var m={};m[l.orientation=="horizontal"?"left":"bottom"]=o+"%";a(this).stop(1,1)[c?"animate":"css"](m,d.animate);if(l.options.range===true){if(l.orientation=="horizontal"){(p==0)&&l.range.stop(1,1)[c?"animate":"css"]({left:o+"%"},d.animate);(p==1)&&l.range[c?"animate":"css"]({width:(o-lastValPercent)+"%"},{queue:false,duration:d.animate})}else{(p==0)&&l.range.stop(1,1)[c?"animate":"css"]({bottom:(o)+"%"},d.animate);(p==1)&&l.range[c?"animate":"css"]({height:(o-lastValPercent)+"%"},{queue:false,duration:d.animate})}}lastValPercent=o})}else{var j=this.value(),g=this._valueMin(),k=this._valueMax(),e=k!=g?(j-g)/(k-g)*100:0;var b={};b[l.orientation=="horizontal"?"left":"bottom"]=e+"%";this.handle.stop(1,1)[c?"animate":"css"](b,d.animate);(f=="min")&&(this.orientation=="horizontal")&&this.range.stop(1,1)[c?"animate":"css"]({width:e+"%"},d.animate);(f=="max")&&(this.orientation=="horizontal")&&this.range[c?"animate":"css"]({width:(100-e)+"%"},{queue:false,duration:d.animate});(f=="min")&&(this.orientation=="vertical")&&this.range.stop(1,1)[c?"animate":"css"]({height:e+"%"},d.animate);(f=="max")&&(this.orientation=="vertical")&&this.range[c?"animate":"css"]({height:(100-e)+"%"},{queue:false,duration:d.animate})}}}));a.extend(a.ui.slider,{getter:"value values",version:"1.7.1",eventPrefix:"slide",defaults:{animate:false,delay:0,distance:0,max:100,min:0,orientation:"horizontal",range:false,step:1,value:0,values:null}})})(jQuery);;/*
- * jQuery UI Tabs 1.7.1
- *
- * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT (MIT-LICENSE.txt)
- * and GPL (GPL-LICENSE.txt) licenses.
- *
- * http://docs.jquery.com/UI/Tabs
- *
- * Depends:
- * ui.core.js
- */
(function(a){a.widget("ui.tabs",{_init:function(){if(this.options.deselectable!==undefined){this.options.collapsible=this.options.deselectable}this._tabify(true)},_setData:function(b,c){if(b=="selected"){if(this.options.collapsible&&c==this.options.selected){return}this.select(c)}else{this.options[b]=c;if(b=="deselectable"){this.options.collapsible=c}this._tabify()}},_tabId:function(b){return b.title&&b.title.replace(/\s/g,"_").replace(/[^A-Za-z0-9\-_:\.]/g,"")||this.options.idPrefix+a.data(b)},_sanitizeSelector:function(b){return b.replace(/:/g,"\\:")},_cookie:function(){var b=this.cookie||(this.cookie=this.options.cookie.name||"ui-tabs-"+a.data(this.list[0]));return a.cookie.apply(null,[b].concat(a.makeArray(arguments)))},_ui:function(c,b){return{tab:c,panel:b,index:this.anchors.index(c)}},_cleanup:function(){this.lis.filter(".ui-state-processing").removeClass("ui-state-processing").find("span:data(label.tabs)").each(function(){var b=a(this);b.html(b.data("label.tabs")).removeData("label.tabs")})},_tabify:function(n){this.list=this.element.children("ul:first");this.lis=a("li:has(a[href])",this.list);this.anchors=this.lis.map(function(){return a("a",this)[0]});this.panels=a([]);var p=this,d=this.options;var c=/^#.+/;this.anchors.each(function(r,o){var q=a(o).attr("href");var s=q.split("#")[0],u;if(s&&(s===location.toString().split("#")[0]||(u=a("base")[0])&&s===u.href)){q=o.hash;o.href=q}if(c.test(q)){p.panels=p.panels.add(p._sanitizeSelector(q))}else{if(q!="#"){a.data(o,"href.tabs",q);a.data(o,"load.tabs",q.replace(/#.*$/,""));var w=p._tabId(o);o.href="#"+w;var v=a("#"+w);if(!v.length){v=a(d.panelTemplate).attr("id",w).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").insertAfter(p.panels[r-1]||p.list);v.data("destroy.tabs",true)}p.panels=p.panels.add(v)}else{d.disabled.push(r)}}});if(n){this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all");this.list.addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.lis.addClass("ui-state-default ui-corner-top");this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom");if(d.selected===undefined){if(location.hash){this.anchors.each(function(q,o){if(o.hash==location.hash){d.selected=q;return false}})}if(typeof d.selected!="number"&&d.cookie){d.selected=parseInt(p._cookie(),10)}if(typeof d.selected!="number"&&this.lis.filter(".ui-tabs-selected").length){d.selected=this.lis.index(this.lis.filter(".ui-tabs-selected"))}d.selected=d.selected||0}else{if(d.selected===null){d.selected=-1}}d.selected=((d.selected>=0&&this.anchors[d.selected])||d.selected<0)?d.selected:0;d.disabled=a.unique(d.disabled.concat(a.map(this.lis.filter(".ui-state-disabled"),function(q,o){return p.lis.index(q)}))).sort();if(a.inArray(d.selected,d.disabled)!=-1){d.disabled.splice(a.inArray(d.selected,d.disabled),1)}this.panels.addClass("ui-tabs-hide");this.lis.removeClass("ui-tabs-selected ui-state-active");if(d.selected>=0&&this.anchors.length){this.panels.eq(d.selected).removeClass("ui-tabs-hide");this.lis.eq(d.selected).addClass("ui-tabs-selected ui-state-active");p.element.queue("tabs",function(){p._trigger("show",null,p._ui(p.anchors[d.selected],p.panels[d.selected]))});this.load(d.selected)}a(window).bind("unload",function(){p.lis.add(p.anchors).unbind(".tabs");p.lis=p.anchors=p.panels=null})}else{d.selected=this.lis.index(this.lis.filter(".ui-tabs-selected"))}this.element[d.collapsible?"addClass":"removeClass"]("ui-tabs-collapsible");if(d.cookie){this._cookie(d.selected,d.cookie)}for(var g=0,m;(m=this.lis[g]);g++){a(m)[a.inArray(g,d.disabled)!=-1&&!a(m).hasClass("ui-tabs-selected")?"addClass":"removeClass"]("ui-state-disabled")}if(d.cache===false){this.anchors.removeData("cache.tabs")}this.lis.add(this.anchors).unbind(".tabs");if(d.event!="mouseover"){var f=function(o,i){if(i.is(":not(.ui-state-disabled)")){i.addClass("ui-state-"+o)}};var j=function(o,i){i.removeClass("ui-state-"+o)};this.lis.bind("mouseover.tabs",function(){f("hover",a(this))});this.lis.bind("mouseout.tabs",function(){j("hover",a(this))});this.anchors.bind("focus.tabs",function(){f("focus",a(this).closest("li"))});this.anchors.bind("blur.tabs",function(){j("focus",a(this).closest("li"))})}var b,h;if(d.fx){if(a.isArray(d.fx)){b=d.fx[0];h=d.fx[1]}else{b=h=d.fx}}function e(i,o){i.css({display:""});if(a.browser.msie&&o.opacity){i[0].style.removeAttribute("filter")}}var k=h?function(i,o){a(i).closest("li").removeClass("ui-state-default").addClass("ui-tabs-selected ui-state-active");o.hide().removeClass("ui-tabs-hide").animate(h,h.duration||"normal",function(){e(o,h);p._trigger("show",null,p._ui(i,o[0]))})}:function(i,o){a(i).closest("li").removeClass("ui-state-default").addClass("ui-tabs-selected ui-state-active");o.removeClass("ui-tabs-hide");p._trigger("show",null,p._ui(i,o[0]))};var l=b?function(o,i){i.animate(b,b.duration||"normal",function(){p.lis.removeClass("ui-tabs-selected ui-state-active").addClass("ui-state-default");i.addClass("ui-tabs-hide");e(i,b);p.element.dequeue("tabs")})}:function(o,i,q){p.lis.removeClass("ui-tabs-selected ui-state-active").addClass("ui-state-default");i.addClass("ui-tabs-hide");p.element.dequeue("tabs")};this.anchors.bind(d.event+".tabs",function(){var o=this,r=a(this).closest("li"),i=p.panels.filter(":not(.ui-tabs-hide)"),q=a(p._sanitizeSelector(this.hash));if((r.hasClass("ui-tabs-selected")&&!d.collapsible)||r.hasClass("ui-state-disabled")||r.hasClass("ui-state-processing")||p._trigger("select",null,p._ui(this,q[0]))===false){this.blur();return false}d.selected=p.anchors.index(this);p.abort();if(d.collapsible){if(r.hasClass("ui-tabs-selected")){d.selected=-1;if(d.cookie){p._cookie(d.selected,d.cookie)}p.element.queue("tabs",function(){l(o,i)}).dequeue("tabs");this.blur();return false}else{if(!i.length){if(d.cookie){p._cookie(d.selected,d.cookie)}p.element.queue("tabs",function(){k(o,q)});p.load(p.anchors.index(this));this.blur();return false}}}if(d.cookie){p._cookie(d.selected,d.cookie)}if(q.length){if(i.length){p.element.queue("tabs",function(){l(o,i)})}p.element.queue("tabs",function(){k(o,q)});p.load(p.anchors.index(this))}else{throw"jQuery UI Tabs: Mismatching fragment identifier."}if(a.browser.msie){this.blur()}});this.anchors.bind("click.tabs",function(){return false})},destroy:function(){var b=this.options;this.abort();this.element.unbind(".tabs").removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible").removeData("tabs");this.list.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.anchors.each(function(){var c=a.data(this,"href.tabs");if(c){this.href=c}var d=a(this).unbind(".tabs");a.each(["href","load","cache"],function(e,f){d.removeData(f+".tabs")})});this.lis.unbind(".tabs").add(this.panels).each(function(){if(a.data(this,"destroy.tabs")){a(this).remove()}else{a(this).removeClass(["ui-state-default","ui-corner-top","ui-tabs-selected","ui-state-active","ui-state-hover","ui-state-focus","ui-state-disabled","ui-tabs-panel","ui-widget-content","ui-corner-bottom","ui-tabs-hide"].join(" "))}});if(b.cookie){this._cookie(null,b.cookie)}},add:function(e,d,c){if(c===undefined){c=this.anchors.length}var b=this,g=this.options,i=a(g.tabTemplate.replace(/#\{href\}/g,e).replace(/#\{label\}/g,d)),h=!e.indexOf("#")?e.replace("#",""):this._tabId(a("a",i)[0]);i.addClass("ui-state-default ui-corner-top").data("destroy.tabs",true);var f=a("#"+h);if(!f.length){f=a(g.panelTemplate).attr("id",h).data("destroy.tabs",true)}f.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide");if(c>=this.lis.length){i.appendTo(this.list);f.appendTo(this.list[0].parentNode)}else{i.insertBefore(this.lis[c]);f.insertBefore(this.panels[c])}g.disabled=a.map(g.disabled,function(k,j){return k>=c?++k:k});this._tabify();if(this.anchors.length==1){i.addClass("ui-tabs-selected ui-state-active");f.removeClass("ui-tabs-hide");this.element.queue("tabs",function(){b._trigger("show",null,b._ui(b.anchors[0],b.panels[0]))});this.load(0)}this._trigger("add",null,this._ui(this.anchors[c],this.panels[c]))},remove:function(b){var d=this.options,e=this.lis.eq(b).remove(),c=this.panels.eq(b).remove();if(e.hasClass("ui-tabs-selected")&&this.anchors.length>1){this.select(b+(b+1<this.anchors.length?1:-1))}d.disabled=a.map(a.grep(d.disabled,function(g,f){return g!=b}),function(g,f){return g>=b?--g:g});this._tabify();this._trigger("remove",null,this._ui(e.find("a")[0],c[0]))},enable:function(b){var c=this.options;if(a.inArray(b,c.disabled)==-1){return}this.lis.eq(b).removeClass("ui-state-disabled");c.disabled=a.grep(c.disabled,function(e,d){return e!=b});this._trigger("enable",null,this._ui(this.anchors[b],this.panels[b]))},disable:function(c){var b=this,d=this.options;if(c!=d.selected){this.lis.eq(c).addClass("ui-state-disabled");d.disabled.push(c);d.disabled.sort();this._trigger("disable",null,this._ui(this.anchors[c],this.panels[c]))}},select:function(b){if(typeof b=="string"){b=this.anchors.index(this.anchors.filter("[href$="+b+"]"))}else{if(b===null){b=-1}}if(b==-1&&this.options.collapsible){b=this.options.selected}this.anchors.eq(b).trigger(this.options.event+".tabs")},load:function(e){var c=this,g=this.options,b=this.anchors.eq(e)[0],d=a.data(b,"load.tabs");this.abort();if(!d||this.element.queue("tabs").length!==0&&a.data(b,"cache.tabs")){this.element.dequeue("tabs");return}this.lis.eq(e).addClass("ui-state-processing");if(g.spinner){var f=a("span",b);f.data("label.tabs",f.html()).html(g.spinner)}this.xhr=a.ajax(a.extend({},g.ajaxOptions,{url:d,success:function(i,h){a(c._sanitizeSelector(b.hash)).html(i);c._cleanup();if(g.cache){a.data(b,"cache.tabs",true)}c._trigger("load",null,c._ui(c.anchors[e],c.panels[e]));try{g.ajaxOptions.success(i,h)}catch(j){}c.element.dequeue("tabs")}}))},abort:function(){this.element.queue([]);this.panels.stop(false,true);if(this.xhr){this.xhr.abort();delete this.xhr}this._cleanup()},url:function(c,b){this.anchors.eq(c).removeData("cache.tabs").data("load.tabs",b)},length:function(){return this.anchors.length}});a.extend(a.ui.tabs,{version:"1.7.1",getter:"length",defaults:{ajaxOptions:null,cache:false,cookie:null,collapsible:false,disabled:[],event:"click",fx:null,idPrefix:"ui-tabs-",panelTemplate:"<div></div>",spinner:"<em>Loading…</em>",tabTemplate:'<li><a href="#{href}"><span>#{label}</span></a></li>'}});a.extend(a.ui.tabs.prototype,{rotation:null,rotate:function(d,f){var b=this,g=this.options;var c=b._rotate||(b._rotate=function(h){clearTimeout(b.rotation);b.rotation=setTimeout(function(){var i=g.selected;b.select(++i<b.anchors.length?i:0)},d);if(h){h.stopPropagation()}});var e=b._unrotate||(b._unrotate=!f?function(h){if(h.clientX){b.rotate(null)}}:function(h){t=g.selected;c()});if(d){this.element.bind("tabsshow",c);this.anchors.bind(g.event+".tabs",e);c()}else{clearTimeout(b.rotation);this.element.unbind("tabsshow",c);this.anchors.unbind(g.event+".tabs",e);delete this._rotate;delete this._unrotate}}})})(jQuery);;/*
- * jQuery UI Datepicker 1.7.1
- *
- * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT (MIT-LICENSE.txt)
- * and GPL (GPL-LICENSE.txt) licenses.
- *
- * http://docs.jquery.com/UI/Datepicker
- *
- * Depends:
- * ui.core.js
- */
(function($){$.extend($.ui,{datepicker:{version:"1.7.1"}});var PROP_NAME="datepicker";function Datepicker(){this.debug=false;this._curInst=null;this._keyEvent=false;this._disabledInputs=[];this._datepickerShowing=false;this._inDialog=false;this._mainDivId="ui-datepicker-div";this._inlineClass="ui-datepicker-inline";this._appendClass="ui-datepicker-append";this._triggerClass="ui-datepicker-trigger";this._dialogClass="ui-datepicker-dialog";this._disableClass="ui-datepicker-disabled";this._unselectableClass="ui-datepicker-unselectable";this._currentClass="ui-datepicker-current-day";this._dayOverClass="ui-datepicker-days-cell-over";this.regional=[];this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],dateFormat:"mm/dd/yy",firstDay:0,isRTL:false};this._defaults={showOn:"focus",showAnim:"show",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:false,hideIfNoPrevNext:false,navigationAsDateFormat:false,gotoCurrent:false,changeMonth:false,changeYear:false,showMonthAfterYear:false,yearRange:"-10:+10",showOtherMonths:false,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",minDate:null,maxDate:null,duration:"normal",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:true,showButtonPanel:false};$.extend(this._defaults,this.regional[""]);this.dpDiv=$('<div id="'+this._mainDivId+'" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all ui-helper-hidden-accessible"></div>')}$.extend(Datepicker.prototype,{markerClassName:"hasDatepicker",log:function(){if(this.debug){console.log.apply("",arguments)}},setDefaults:function(settings){extendRemove(this._defaults,settings||{});return this},_attachDatepicker:function(target,settings){var inlineSettings=null;for(var attrName in this._defaults){var attrValue=target.getAttribute("date:"+attrName);if(attrValue){inlineSettings=inlineSettings||{};try{inlineSettings[attrName]=eval(attrValue)}catch(err){inlineSettings[attrName]=attrValue}}}var nodeName=target.nodeName.toLowerCase();var inline=(nodeName=="div"||nodeName=="span");if(!target.id){target.id="dp"+(++this.uuid)}var inst=this._newInst($(target),inline);inst.settings=$.extend({},settings||{},inlineSettings||{});if(nodeName=="input"){this._connectDatepicker(target,inst)}else{if(inline){this._inlineDatepicker(target,inst)}}},_newInst:function(target,inline){var id=target[0].id.replace(/([:\[\]\.])/g,"\\\\$1");return{id:id,input:target,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:inline,dpDiv:(!inline?this.dpDiv:$('<div class="'+this._inlineClass+' ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>'))}},_connectDatepicker:function(target,inst){var input=$(target);inst.trigger=$([]);if(input.hasClass(this.markerClassName)){return}var appendText=this._get(inst,"appendText");var isRTL=this._get(inst,"isRTL");if(appendText){input[isRTL?"before":"after"]('<span class="'+this._appendClass+'">'+appendText+"</span>")}var showOn=this._get(inst,"showOn");if(showOn=="focus"||showOn=="both"){input.focus(this._showDatepicker)}if(showOn=="button"||showOn=="both"){var buttonText=this._get(inst,"buttonText");var buttonImage=this._get(inst,"buttonImage");inst.trigger=$(this._get(inst,"buttonImageOnly")?$("<img/>").addClass(this._triggerClass).attr({src:buttonImage,alt:buttonText,title:buttonText}):$('<button type="button"></button>').addClass(this._triggerClass).html(buttonImage==""?buttonText:$("<img/>").attr({src:buttonImage,alt:buttonText,title:buttonText})));input[isRTL?"before":"after"](inst.trigger);inst.trigger.click(function(){if($.datepicker._datepickerShowing&&$.datepicker._lastInput==target){$.datepicker._hideDatepicker()}else{$.datepicker._showDatepicker(target)}return false})}input.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).bind("setData.datepicker",function(event,key,value){inst.settings[key]=value}).bind("getData.datepicker",function(event,key){return this._get(inst,key)});$.data(target,PROP_NAME,inst)},_inlineDatepicker:function(target,inst){var divSpan=$(target);if(divSpan.hasClass(this.markerClassName)){return}divSpan.addClass(this.markerClassName).append(inst.dpDiv).bind("setData.datepicker",function(event,key,value){inst.settings[key]=value}).bind("getData.datepicker",function(event,key){return this._get(inst,key)});$.data(target,PROP_NAME,inst);this._setDate(inst,this._getDefaultDate(inst));this._updateDatepicker(inst);this._updateAlternate(inst)},_dialogDatepicker:function(input,dateText,onSelect,settings,pos){var inst=this._dialogInst;if(!inst){var id="dp"+(++this.uuid);this._dialogInput=$('<input type="text" id="'+id+'" size="1" style="position: absolute; top: -100px;"/>');this._dialogInput.keydown(this._doKeyDown);$("body").append(this._dialogInput);inst=this._dialogInst=this._newInst(this._dialogInput,false);inst.settings={};$.data(this._dialogInput[0],PROP_NAME,inst)}extendRemove(inst.settings,settings||{});this._dialogInput.val(dateText);this._pos=(pos?(pos.length?pos:[pos.pageX,pos.pageY]):null);if(!this._pos){var browserWidth=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth;var browserHeight=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight;var scrollX=document.documentElement.scrollLeft||document.body.scrollLeft;var scrollY=document.documentElement.scrollTop||document.body.scrollTop;this._pos=[(browserWidth/2)-100+scrollX,(browserHeight/2)-150+scrollY]}this._dialogInput.css("left",this._pos[0]+"px").css("top",this._pos[1]+"px");inst.settings.onSelect=onSelect;this._inDialog=true;this.dpDiv.addClass(this._dialogClass);this._showDatepicker(this._dialogInput[0]);if($.blockUI){$.blockUI(this.dpDiv)}$.data(this._dialogInput[0],PROP_NAME,inst);return this},_destroyDatepicker:function(target){var $target=$(target);var inst=$.data(target,PROP_NAME);if(!$target.hasClass(this.markerClassName)){return}var nodeName=target.nodeName.toLowerCase();$.removeData(target,PROP_NAME);if(nodeName=="input"){inst.trigger.remove();$target.siblings("."+this._appendClass).remove().end().removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress)}else{if(nodeName=="div"||nodeName=="span"){$target.removeClass(this.markerClassName).empty()}}},_enableDatepicker:function(target){var $target=$(target);var inst=$.data(target,PROP_NAME);if(!$target.hasClass(this.markerClassName)){return}var nodeName=target.nodeName.toLowerCase();if(nodeName=="input"){target.disabled=false;inst.trigger.filter("button").each(function(){this.disabled=false}).end().filter("img").css({opacity:"1.0",cursor:""})}else{if(nodeName=="div"||nodeName=="span"){var inline=$target.children("."+this._inlineClass);inline.children().removeClass("ui-state-disabled")}}this._disabledInputs=$.map(this._disabledInputs,function(value){return(value==target?null:value)})},_disableDatepicker:function(target){var $target=$(target);var inst=$.data(target,PROP_NAME);if(!$target.hasClass(this.markerClassName)){return}var nodeName=target.nodeName.toLowerCase();if(nodeName=="input"){target.disabled=true;inst.trigger.filter("button").each(function(){this.disabled=true}).end().filter("img").css({opacity:"0.5",cursor:"default"})}else{if(nodeName=="div"||nodeName=="span"){var inline=$target.children("."+this._inlineClass);inline.children().addClass("ui-state-disabled")}}this._disabledInputs=$.map(this._disabledInputs,function(value){return(value==target?null:value)});this._disabledInputs[this._disabledInputs.length]=target},_isDisabledDatepicker:function(target){if(!target){return false}for(var i=0;i<this._disabledInputs.length;i++){if(this._disabledInputs[i]==target){return true}}return false},_getInst:function(target){try{return $.data(target,PROP_NAME)}catch(err){throw"Missing instance data for this datepicker"}},_optionDatepicker:function(target,name,value){var settings=name||{};if(typeof name=="string"){settings={};settings[name]=value}var inst=this._getInst(target);if(inst){if(this._curInst==inst){this._hideDatepicker(null)}extendRemove(inst.settings,settings);var date=new Date();extendRemove(inst,{rangeStart:null,endDay:null,endMonth:null,endYear:null,selectedDay:date.getDate(),selectedMonth:date.getMonth(),selectedYear:date.getFullYear(),currentDay:date.getDate(),currentMonth:date.getMonth(),currentYear:date.getFullYear(),drawMonth:date.getMonth(),drawYear:date.getFullYear()});this._updateDatepicker(inst)}},_changeDatepicker:function(target,name,value){this._optionDatepicker(target,name,value)},_refreshDatepicker:function(target){var inst=this._getInst(target);if(inst){this._updateDatepicker(inst)}},_setDateDatepicker:function(target,date,endDate){var inst=this._getInst(target);if(inst){this._setDate(inst,date,endDate);this._updateDatepicker(inst);this._updateAlternate(inst)}},_getDateDatepicker:function(target){var inst=this._getInst(target);if(inst&&!inst.inline){this._setDateFromField(inst)}return(inst?this._getDate(inst):null)},_doKeyDown:function(event){var inst=$.datepicker._getInst(event.target);var handled=true;var isRTL=inst.dpDiv.is(".ui-datepicker-rtl");inst._keyEvent=true;if($.datepicker._datepickerShowing){switch(event.keyCode){case 9:$.datepicker._hideDatepicker(null,"");break;case 13:var sel=$("td."+$.datepicker._dayOverClass+", td."+$.datepicker._currentClass,inst.dpDiv);if(sel[0]){$.datepicker._selectDay(event.target,inst.selectedMonth,inst.selectedYear,sel[0])}else{$.datepicker._hideDatepicker(null,$.datepicker._get(inst,"duration"))}return false;break;case 27:$.datepicker._hideDatepicker(null,$.datepicker._get(inst,"duration"));break;case 33:$.datepicker._adjustDate(event.target,(event.ctrlKey?-$.datepicker._get(inst,"stepBigMonths"):-$.datepicker._get(inst,"stepMonths")),"M");break;case 34:$.datepicker._adjustDate(event.target,(event.ctrlKey?+$.datepicker._get(inst,"stepBigMonths"):+$.datepicker._get(inst,"stepMonths")),"M");break;case 35:if(event.ctrlKey||event.metaKey){$.datepicker._clearDate(event.target)}handled=event.ctrlKey||event.metaKey;break;case 36:if(event.ctrlKey||event.metaKey){$.datepicker._gotoToday(event.target)}handled=event.ctrlKey||event.metaKey;break;case 37:if(event.ctrlKey||event.metaKey){$.datepicker._adjustDate(event.target,(isRTL?+1:-1),"D")}handled=event.ctrlKey||event.metaKey;if(event.originalEvent.altKey){$.datepicker._adjustDate(event.target,(event.ctrlKey?-$.datepicker._get(inst,"stepBigMonths"):-$.datepicker._get(inst,"stepMonths")),"M")}break;case 38:if(event.ctrlKey||event.metaKey){$.datepicker._adjustDate(event.target,-7,"D")}handled=event.ctrlKey||event.metaKey;break;case 39:if(event.ctrlKey||event.metaKey){$.datepicker._adjustDate(event.target,(isRTL?-1:+1),"D")}handled=event.ctrlKey||event.metaKey;if(event.originalEvent.altKey){$.datepicker._adjustDate(event.target,(event.ctrlKey?+$.datepicker._get(inst,"stepBigMonths"):+$.datepicker._get(inst,"stepMonths")),"M")}break;case 40:if(event.ctrlKey||event.metaKey){$.datepicker._adjustDate(event.target,+7,"D")}handled=event.ctrlKey||event.metaKey;break;default:handled=false}}else{if(event.keyCode==36&&event.ctrlKey){$.datepicker._showDatepicker(this)}else{handled=false}}if(handled){event.preventDefault();event.stopPropagation()}},_doKeyPress:function(event){var inst=$.datepicker._getInst(event.target);if($.datepicker._get(inst,"constrainInput")){var chars=$.datepicker._possibleChars($.datepicker._get(inst,"dateFormat"));var chr=String.fromCharCode(event.charCode==undefined?event.keyCode:event.charCode);return event.ctrlKey||(chr<" "||!chars||chars.indexOf(chr)>-1)}},_showDatepicker:function(input){input=input.target||input;if(input.nodeName.toLowerCase()!="input"){input=$("input",input.parentNode)[0]}if($.datepicker._isDisabledDatepicker(input)||$.datepicker._lastInput==input){return}var inst=$.datepicker._getInst(input);var beforeShow=$.datepicker._get(inst,"beforeShow");extendRemove(inst.settings,(beforeShow?beforeShow.apply(input,[input,inst]):{}));$.datepicker._hideDatepicker(null,"");$.datepicker._lastInput=input;$.datepicker._setDateFromField(inst);if($.datepicker._inDialog){input.value=""}if(!$.datepicker._pos){$.datepicker._pos=$.datepicker._findPos(input);$.datepicker._pos[1]+=input.offsetHeight}var isFixed=false;$(input).parents().each(function(){isFixed|=$(this).css("position")=="fixed";return !isFixed});if(isFixed&&$.browser.opera){$.datepicker._pos[0]-=document.documentElement.scrollLeft;$.datepicker._pos[1]-=document.documentElement.scrollTop}var offset={left:$.datepicker._pos[0],top:$.datepicker._pos[1]};$.datepicker._pos=null;inst.rangeStart=null;inst.dpDiv.css({position:"absolute",display:"block",top:"-1000px"});$.datepicker._updateDatepicker(inst);offset=$.datepicker._checkOffset(inst,offset,isFixed);inst.dpDiv.css({position:($.datepicker._inDialog&&$.blockUI?"static":(isFixed?"fixed":"absolute")),display:"none",left:offset.left+"px",top:offset.top+"px"});if(!inst.inline){var showAnim=$.datepicker._get(inst,"showAnim")||"show";var duration=$.datepicker._get(inst,"duration");var postProcess=function(){$.datepicker._datepickerShowing=true;if($.browser.msie&&parseInt($.browser.version,10)<7){$("iframe.ui-datepicker-cover").css({width:inst.dpDiv.width()+4,height:inst.dpDiv.height()+4})}};if($.effects&&$.effects[showAnim]){inst.dpDiv.show(showAnim,$.datepicker._get(inst,"showOptions"),duration,postProcess)}else{inst.dpDiv[showAnim](duration,postProcess)}if(duration==""){postProcess()}if(inst.input[0].type!="hidden"){inst.input[0].focus()}$.datepicker._curInst=inst}},_updateDatepicker:function(inst){var dims={width:inst.dpDiv.width()+4,height:inst.dpDiv.height()+4};var self=this;inst.dpDiv.empty().append(this._generateHTML(inst)).find("iframe.ui-datepicker-cover").css({width:dims.width,height:dims.height}).end().find("button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a").bind("mouseout",function(){$(this).removeClass("ui-state-hover");if(this.className.indexOf("ui-datepicker-prev")!=-1){$(this).removeClass("ui-datepicker-prev-hover")}if(this.className.indexOf("ui-datepicker-next")!=-1){$(this).removeClass("ui-datepicker-next-hover")}}).bind("mouseover",function(){if(!self._isDisabledDatepicker(inst.inline?inst.dpDiv.parent()[0]:inst.input[0])){$(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover");$(this).addClass("ui-state-hover");if(this.className.indexOf("ui-datepicker-prev")!=-1){$(this).addClass("ui-datepicker-prev-hover")}if(this.className.indexOf("ui-datepicker-next")!=-1){$(this).addClass("ui-datepicker-next-hover")}}}).end().find("."+this._dayOverClass+" a").trigger("mouseover").end();var numMonths=this._getNumberOfMonths(inst);var cols=numMonths[1];var width=17;if(cols>1){inst.dpDiv.addClass("ui-datepicker-multi-"+cols).css("width",(width*cols)+"em")}else{inst.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width("")}inst.dpDiv[(numMonths[0]!=1||numMonths[1]!=1?"add":"remove")+"Class"]("ui-datepicker-multi");inst.dpDiv[(this._get(inst,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl");if(inst.input&&inst.input[0].type!="hidden"&&inst==$.datepicker._curInst){$(inst.input[0]).focus()}},_checkOffset:function(inst,offset,isFixed){var dpWidth=inst.dpDiv.outerWidth();var dpHeight=inst.dpDiv.outerHeight();var inputWidth=inst.input?inst.input.outerWidth():0;var inputHeight=inst.input?inst.input.outerHeight():0;var viewWidth=(window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth)+$(document).scrollLeft();var viewHeight=(window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight)+$(document).scrollTop();offset.left-=(this._get(inst,"isRTL")?(dpWidth-inputWidth):0);offset.left-=(isFixed&&offset.left==inst.input.offset().left)?$(document).scrollLeft():0;offset.top-=(isFixed&&offset.top==(inst.input.offset().top+inputHeight))?$(document).scrollTop():0;offset.left-=(offset.left+dpWidth>viewWidth&&viewWidth>dpWidth)?Math.abs(offset.left+dpWidth-viewWidth):0;offset.top-=(offset.top+dpHeight>viewHeight&&viewHeight>dpHeight)?Math.abs(offset.top+dpHeight+inputHeight*2-viewHeight):0;return offset},_findPos:function(obj){while(obj&&(obj.type=="hidden"||obj.nodeType!=1)){obj=obj.nextSibling}var position=$(obj).offset();return[position.left,position.top]},_hideDatepicker:function(input,duration){var inst=this._curInst;if(!inst||(input&&inst!=$.data(input,PROP_NAME))){return}if(inst.stayOpen){this._selectDate("#"+inst.id,this._formatDate(inst,inst.currentDay,inst.currentMonth,inst.currentYear))}inst.stayOpen=false;if(this._datepickerShowing){duration=(duration!=null?duration:this._get(inst,"duration"));var showAnim=this._get(inst,"showAnim");var postProcess=function(){$.datepicker._tidyDialog(inst)};if(duration!=""&&$.effects&&$.effects[showAnim]){inst.dpDiv.hide(showAnim,$.datepicker._get(inst,"showOptions"),duration,postProcess)}else{inst.dpDiv[(duration==""?"hide":(showAnim=="slideDown"?"slideUp":(showAnim=="fadeIn"?"fadeOut":"hide")))](duration,postProcess)}if(duration==""){this._tidyDialog(inst)}var onClose=this._get(inst,"onClose");if(onClose){onClose.apply((inst.input?inst.input[0]:null),[(inst.input?inst.input.val():""),inst])}this._datepickerShowing=false;this._lastInput=null;if(this._inDialog){this._dialogInput.css({position:"absolute",left:"0",top:"-100px"});if($.blockUI){$.unblockUI();$("body").append(this.dpDiv)}}this._inDialog=false}this._curInst=null},_tidyDialog:function(inst){inst.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},_checkExternalClick:function(event){if(!$.datepicker._curInst){return}var $target=$(event.target);if(($target.parents("#"+$.datepicker._mainDivId).length==0)&&!$target.hasClass($.datepicker.markerClassName)&&!$target.hasClass($.datepicker._triggerClass)&&$.datepicker._datepickerShowing&&!($.datepicker._inDialog&&$.blockUI)){$.datepicker._hideDatepicker(null,"")}},_adjustDate:function(id,offset,period){var target=$(id);var inst=this._getInst(target[0]);if(this._isDisabledDatepicker(target[0])){return}this._adjustInstDate(inst,offset+(period=="M"?this._get(inst,"showCurrentAtPos"):0),period);this._updateDatepicker(inst)},_gotoToday:function(id){var target=$(id);var inst=this._getInst(target[0]);if(this._get(inst,"gotoCurrent")&&inst.currentDay){inst.selectedDay=inst.currentDay;inst.drawMonth=inst.selectedMonth=inst.currentMonth;inst.drawYear=inst.selectedYear=inst.currentYear}else{var date=new Date();inst.selectedDay=date.getDate();inst.drawMonth=inst.selectedMonth=date.getMonth();inst.drawYear=inst.selectedYear=date.getFullYear()}this._notifyChange(inst);this._adjustDate(target)},_selectMonthYear:function(id,select,period){var target=$(id);var inst=this._getInst(target[0]);inst._selectingMonthYear=false;inst["selected"+(period=="M"?"Month":"Year")]=inst["draw"+(period=="M"?"Month":"Year")]=parseInt(select.options[select.selectedIndex].value,10);this._notifyChange(inst);this._adjustDate(target)},_clickMonthYear:function(id){var target=$(id);var inst=this._getInst(target[0]);if(inst.input&&inst._selectingMonthYear&&!$.browser.msie){inst.input[0].focus()}inst._selectingMonthYear=!inst._selectingMonthYear},_selectDay:function(id,month,year,td){var target=$(id);if($(td).hasClass(this._unselectableClass)||this._isDisabledDatepicker(target[0])){return}var inst=this._getInst(target[0]);inst.selectedDay=inst.currentDay=$("a",td).html();inst.selectedMonth=inst.currentMonth=month;inst.selectedYear=inst.currentYear=year;if(inst.stayOpen){inst.endDay=inst.endMonth=inst.endYear=null}this._selectDate(id,this._formatDate(inst,inst.currentDay,inst.currentMonth,inst.currentYear));if(inst.stayOpen){inst.rangeStart=this._daylightSavingAdjust(new Date(inst.currentYear,inst.currentMonth,inst.currentDay));this._updateDatepicker(inst)}},_clearDate:function(id){var target=$(id);var inst=this._getInst(target[0]);inst.stayOpen=false;inst.endDay=inst.endMonth=inst.endYear=inst.rangeStart=null;this._selectDate(target,"")},_selectDate:function(id,dateStr){var target=$(id);var inst=this._getInst(target[0]);dateStr=(dateStr!=null?dateStr:this._formatDate(inst));if(inst.input){inst.input.val(dateStr)}this._updateAlternate(inst);var onSelect=this._get(inst,"onSelect");if(onSelect){onSelect.apply((inst.input?inst.input[0]:null),[dateStr,inst])}else{if(inst.input){inst.input.trigger("change")}}if(inst.inline){this._updateDatepicker(inst)}else{if(!inst.stayOpen){this._hideDatepicker(null,this._get(inst,"duration"));this._lastInput=inst.input[0];if(typeof(inst.input[0])!="object"){inst.input[0].focus()}this._lastInput=null}}},_updateAlternate:function(inst){var altField=this._get(inst,"altField");if(altField){var altFormat=this._get(inst,"altFormat")||this._get(inst,"dateFormat");var date=this._getDate(inst);dateStr=this.formatDate(altFormat,date,this._getFormatConfig(inst));$(altField).each(function(){$(this).val(dateStr)})}},noWeekends:function(date){var day=date.getDay();return[(day>0&&day<6),""]},iso8601Week:function(date){var checkDate=new Date(date.getFullYear(),date.getMonth(),date.getDate());var firstMon=new Date(checkDate.getFullYear(),1-1,4);var firstDay=firstMon.getDay()||7;firstMon.setDate(firstMon.getDate()+1-firstDay);if(firstDay<4&&checkDate<firstMon){checkDate.setDate(checkDate.getDate()-3);return $.datepicker.iso8601Week(checkDate)}else{if(checkDate>new Date(checkDate.getFullYear(),12-1,28)){firstDay=new Date(checkDate.getFullYear()+1,1-1,4).getDay()||7;if(firstDay>4&&(checkDate.getDay()||7)<firstDay-3){return 1}}}return Math.floor(((checkDate-firstMon)/86400000)/7)+1},parseDate:function(format,value,settings){if(format==null||value==null){throw"Invalid arguments"}value=(typeof value=="object"?value.toString():value+"");if(value==""){return null}var shortYearCutoff=(settings?settings.shortYearCutoff:null)||this._defaults.shortYearCutoff;var dayNamesShort=(settings?settings.dayNamesShort:null)||this._defaults.dayNamesShort;var dayNames=(settings?settings.dayNames:null)||this._defaults.dayNames;var monthNamesShort=(settings?settings.monthNamesShort:null)||this._defaults.monthNamesShort;var monthNames=(settings?settings.monthNames:null)||this._defaults.monthNames;var year=-1;var month=-1;var day=-1;var doy=-1;var literal=false;var lookAhead=function(match){var matches=(iFormat+1<format.length&&format.charAt(iFormat+1)==match);if(matches){iFormat++}return matches};var getNumber=function(match){lookAhead(match);var origSize=(match=="@"?14:(match=="y"?4:(match=="o"?3:2)));var size=origSize;var num=0;while(size>0&&iValue<value.length&&value.charAt(iValue)>="0"&&value.charAt(iValue)<="9"){num=num*10+parseInt(value.charAt(iValue++),10);size--}if(size==origSize){throw"Missing number at position "+iValue}return num};var getName=function(match,shortNames,longNames){var names=(lookAhead(match)?longNames:shortNames);var size=0;for(var j=0;j<names.length;j++){size=Math.max(size,names[j].length)}var name="";var iInit=iValue;while(size>0&&iValue<value.length){name+=value.charAt(iValue++);for(var i=0;i<names.length;i++){if(name==names[i]){return i+1}}size--}throw"Unknown name at position "+iInit};var checkLiteral=function(){if(value.charAt(iValue)!=format.charAt(iFormat)){throw"Unexpected literal at position "+iValue}iValue++};var iValue=0;for(var iFormat=0;iFormat<format.length;iFormat++){if(literal){if(format.charAt(iFormat)=="'"&&!lookAhead("'")){literal=false}else{checkLiteral()}}else{switch(format.charAt(iFormat)){case"d":day=getNumber("d");break;case"D":getName("D",dayNamesShort,dayNames);break;case"o":doy=getNumber("o");break;case"m":month=getNumber("m");break;case"M":month=getName("M",monthNamesShort,monthNames);break;case"y":year=getNumber("y");break;case"@":var date=new Date(getNumber("@"));year=date.getFullYear();month=date.getMonth()+1;day=date.getDate();break;case"'":if(lookAhead("'")){checkLiteral()}else{literal=true}break;default:checkLiteral()}}}if(year==-1){year=new Date().getFullYear()}else{if(year<100){year+=new Date().getFullYear()-new Date().getFullYear()%100+(year<=shortYearCutoff?0:-100)}}if(doy>-1){month=1;day=doy;do{var dim=this._getDaysInMonth(year,month-1);if(day<=dim){break}month++;day-=dim}while(true)}var date=this._daylightSavingAdjust(new Date(year,month-1,day));if(date.getFullYear()!=year||date.getMonth()+1!=month||date.getDate()!=day){throw"Invalid date"}return date},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TIMESTAMP:"@",W3C:"yy-mm-dd",formatDate:function(format,date,settings){if(!date){return""}var dayNamesShort=(settings?settings.dayNamesShort:null)||this._defaults.dayNamesShort;var dayNames=(settings?settings.dayNames:null)||this._defaults.dayNames;var monthNamesShort=(settings?settings.monthNamesShort:null)||this._defaults.monthNamesShort;var monthNames=(settings?settings.monthNames:null)||this._defaults.monthNames;var lookAhead=function(match){var matches=(iFormat+1<format.length&&format.charAt(iFormat+1)==match);if(matches){iFormat++}return matches};var formatNumber=function(match,value,len){var num=""+value;if(lookAhead(match)){while(num.length<len){num="0"+num}}return num};var formatName=function(match,value,shortNames,longNames){return(lookAhead(match)?longNames[value]:shortNames[value])};var output="";var literal=false;if(date){for(var iFormat=0;iFormat<format.length;iFormat++){if(literal){if(format.charAt(iFormat)=="'"&&!lookAhead("'")){literal=false}else{output+=format.charAt(iFormat)}}else{switch(format.charAt(iFormat)){case"d":output+=formatNumber("d",date.getDate(),2);break;case"D":output+=formatName("D",date.getDay(),dayNamesShort,dayNames);break;case"o":var doy=date.getDate();for(var m=date.getMonth()-1;m>=0;m--){doy+=this._getDaysInMonth(date.getFullYear(),m)}output+=formatNumber("o",doy,3);break;case"m":output+=formatNumber("m",date.getMonth()+1,2);break;case"M":output+=formatName("M",date.getMonth(),monthNamesShort,monthNames);break;case"y":output+=(lookAhead("y")?date.getFullYear():(date.getYear()%100<10?"0":"")+date.getYear()%100);break;case"@":output+=date.getTime();break;case"'":if(lookAhead("'")){output+="'"}else{literal=true}break;default:output+=format.charAt(iFormat)}}}}return output},_possibleChars:function(format){var chars="";var literal=false;for(var iFormat=0;iFormat<format.length;iFormat++){if(literal){if(format.charAt(iFormat)=="'"&&!lookAhead("'")){literal=false}else{chars+=format.charAt(iFormat)}}else{switch(format.charAt(iFormat)){case"d":case"m":case"y":case"@":chars+="0123456789";break;case"D":case"M":return null;case"'":if(lookAhead("'")){chars+="'"}else{literal=true}break;default:chars+=format.charAt(iFormat)}}}return chars},_get:function(inst,name){return inst.settings[name]!==undefined?inst.settings[name]:this._defaults[name]},_setDateFromField:function(inst){var dateFormat=this._get(inst,"dateFormat");var dates=inst.input?inst.input.val():null;inst.endDay=inst.endMonth=inst.endYear=null;var date=defaultDate=this._getDefaultDate(inst);var settings=this._getFormatConfig(inst);try{date=this.parseDate(dateFormat,dates,settings)||defaultDate}catch(event){this.log(event);date=defaultDate}inst.selectedDay=date.getDate();inst.drawMonth=inst.selectedMonth=date.getMonth();inst.drawYear=inst.selectedYear=date.getFullYear();inst.currentDay=(dates?date.getDate():0);inst.currentMonth=(dates?date.getMonth():0);inst.currentYear=(dates?date.getFullYear():0);this._adjustInstDate(inst)},_getDefaultDate:function(inst){var date=this._determineDate(this._get(inst,"defaultDate"),new Date());var minDate=this._getMinMaxDate(inst,"min",true);var maxDate=this._getMinMaxDate(inst,"max");date=(minDate&&date<minDate?minDate:date);date=(maxDate&&date>maxDate?maxDate:date);return date},_determineDate:function(date,defaultDate){var offsetNumeric=function(offset){var date=new Date();date.setDate(date.getDate()+offset);return date};var offsetString=function(offset,getDaysInMonth){var date=new Date();var year=date.getFullYear();var month=date.getMonth();var day=date.getDate();var pattern=/([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g;var matches=pattern.exec(offset);while(matches){switch(matches[2]||"d"){case"d":case"D":day+=parseInt(matches[1],10);break;case"w":case"W":day+=parseInt(matches[1],10)*7;break;case"m":case"M":month+=parseInt(matches[1],10);day=Math.min(day,getDaysInMonth(year,month));break;case"y":case"Y":year+=parseInt(matches[1],10);day=Math.min(day,getDaysInMonth(year,month));break}matches=pattern.exec(offset)}return new Date(year,month,day)};date=(date==null?defaultDate:(typeof date=="string"?offsetString(date,this._getDaysInMonth):(typeof date=="number"?(isNaN(date)?defaultDate:offsetNumeric(date)):date)));date=(date&&date.toString()=="Invalid Date"?defaultDate:date);if(date){date.setHours(0);date.setMinutes(0);date.setSeconds(0);date.setMilliseconds(0)}return this._daylightSavingAdjust(date)},_daylightSavingAdjust:function(date){if(!date){return null}date.setHours(date.getHours()>12?date.getHours()+2:0);return date},_setDate:function(inst,date,endDate){var clear=!(date);var origMonth=inst.selectedMonth;var origYear=inst.selectedYear;date=this._determineDate(date,new Date());inst.selectedDay=inst.currentDay=date.getDate();inst.drawMonth=inst.selectedMonth=inst.currentMonth=date.getMonth();inst.drawYear=inst.selectedYear=inst.currentYear=date.getFullYear();if(origMonth!=inst.selectedMonth||origYear!=inst.selectedYear){this._notifyChange(inst)}this._adjustInstDate(inst);if(inst.input){inst.input.val(clear?"":this._formatDate(inst))}},_getDate:function(inst){var startDate=(!inst.currentYear||(inst.input&&inst.input.val()=="")?null:this._daylightSavingAdjust(new Date(inst.currentYear,inst.currentMonth,inst.currentDay)));return startDate},_generateHTML:function(inst){var today=new Date();today=this._daylightSavingAdjust(new Date(today.getFullYear(),today.getMonth(),today.getDate()));var isRTL=this._get(inst,"isRTL");var showButtonPanel=this._get(inst,"showButtonPanel");var hideIfNoPrevNext=this._get(inst,"hideIfNoPrevNext");var navigationAsDateFormat=this._get(inst,"navigationAsDateFormat");var numMonths=this._getNumberOfMonths(inst);var showCurrentAtPos=this._get(inst,"showCurrentAtPos");var stepMonths=this._get(inst,"stepMonths");var stepBigMonths=this._get(inst,"stepBigMonths");var isMultiMonth=(numMonths[0]!=1||numMonths[1]!=1);var currentDate=this._daylightSavingAdjust((!inst.currentDay?new Date(9999,9,9):new Date(inst.currentYear,inst.currentMonth,inst.currentDay)));var minDate=this._getMinMaxDate(inst,"min",true);var maxDate=this._getMinMaxDate(inst,"max");var drawMonth=inst.drawMonth-showCurrentAtPos;var drawYear=inst.drawYear;if(drawMonth<0){drawMonth+=12;drawYear--}if(maxDate){var maxDraw=this._daylightSavingAdjust(new Date(maxDate.getFullYear(),maxDate.getMonth()-numMonths[1]+1,maxDate.getDate()));maxDraw=(minDate&&maxDraw<minDate?minDate:maxDraw);while(this._daylightSavingAdjust(new Date(drawYear,drawMonth,1))>maxDraw){drawMonth--;if(drawMonth<0){drawMonth=11;drawYear--}}}inst.drawMonth=drawMonth;inst.drawYear=drawYear;var prevText=this._get(inst,"prevText");prevText=(!navigationAsDateFormat?prevText:this.formatDate(prevText,this._daylightSavingAdjust(new Date(drawYear,drawMonth-stepMonths,1)),this._getFormatConfig(inst)));var prev=(this._canAdjustMonth(inst,-1,drawYear,drawMonth)?'<a class="ui-datepicker-prev ui-corner-all" onclick="DP_jQuery.datepicker._adjustDate(\'#'+inst.id+"', -"+stepMonths+", 'M');\" title=\""+prevText+'"><span class="ui-icon ui-icon-circle-triangle-'+(isRTL?"e":"w")+'">'+prevText+"</span></a>":(hideIfNoPrevNext?"":'<a class="ui-datepicker-prev ui-corner-all ui-state-disabled" title="'+prevText+'"><span class="ui-icon ui-icon-circle-triangle-'+(isRTL?"e":"w")+'">'+prevText+"</span></a>"));var nextText=this._get(inst,"nextText");nextText=(!navigationAsDateFormat?nextText:this.formatDate(nextText,this._daylightSavingAdjust(new Date(drawYear,drawMonth+stepMonths,1)),this._getFormatConfig(inst)));var next=(this._canAdjustMonth(inst,+1,drawYear,drawMonth)?'<a class="ui-datepicker-next ui-corner-all" onclick="DP_jQuery.datepicker._adjustDate(\'#'+inst.id+"', +"+stepMonths+", 'M');\" title=\""+nextText+'"><span class="ui-icon ui-icon-circle-triangle-'+(isRTL?"w":"e")+'">'+nextText+"</span></a>":(hideIfNoPrevNext?"":'<a class="ui-datepicker-next ui-corner-all ui-state-disabled" title="'+nextText+'"><span class="ui-icon ui-icon-circle-triangle-'+(isRTL?"w":"e")+'">'+nextText+"</span></a>"));var currentText=this._get(inst,"currentText");var gotoDate=(this._get(inst,"gotoCurrent")&&inst.currentDay?currentDate:today);currentText=(!navigationAsDateFormat?currentText:this.formatDate(currentText,gotoDate,this._getFormatConfig(inst)));var controls=(!inst.inline?'<button type="button" class="ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all" onclick="DP_jQuery.datepicker._hideDatepicker();">'+this._get(inst,"closeText")+"</button>":"");var buttonPanel=(showButtonPanel)?'<div class="ui-datepicker-buttonpane ui-widget-content">'+(isRTL?controls:"")+(this._isInRange(inst,gotoDate)?'<button type="button" class="ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all" onclick="DP_jQuery.datepicker._gotoToday(\'#'+inst.id+"');\">"+currentText+"</button>":"")+(isRTL?"":controls)+"</div>":"";var firstDay=parseInt(this._get(inst,"firstDay"),10);firstDay=(isNaN(firstDay)?0:firstDay);var dayNames=this._get(inst,"dayNames");var dayNamesShort=this._get(inst,"dayNamesShort");var dayNamesMin=this._get(inst,"dayNamesMin");var monthNames=this._get(inst,"monthNames");var monthNamesShort=this._get(inst,"monthNamesShort");var beforeShowDay=this._get(inst,"beforeShowDay");var showOtherMonths=this._get(inst,"showOtherMonths");var calculateWeek=this._get(inst,"calculateWeek")||this.iso8601Week;var endDate=inst.endDay?this._daylightSavingAdjust(new Date(inst.endYear,inst.endMonth,inst.endDay)):currentDate;var defaultDate=this._getDefaultDate(inst);var html="";for(var row=0;row<numMonths[0];row++){var group="";for(var col=0;col<numMonths[1];col++){var selectedDate=this._daylightSavingAdjust(new Date(drawYear,drawMonth,inst.selectedDay));var cornerClass=" ui-corner-all";var calender="";if(isMultiMonth){calender+='<div class="ui-datepicker-group ui-datepicker-group-';switch(col){case 0:calender+="first";cornerClass=" ui-corner-"+(isRTL?"right":"left");break;case numMonths[1]-1:calender+="last";cornerClass=" ui-corner-"+(isRTL?"left":"right");break;default:calender+="middle";cornerClass="";break}calender+='">'}calender+='<div class="ui-datepicker-header ui-widget-header ui-helper-clearfix'+cornerClass+'">'+(/all|left/.test(cornerClass)&&row==0?(isRTL?next:prev):"")+(/all|right/.test(cornerClass)&&row==0?(isRTL?prev:next):"")+this._generateMonthYearHeader(inst,drawMonth,drawYear,minDate,maxDate,selectedDate,row>0||col>0,monthNames,monthNamesShort)+'</div><table class="ui-datepicker-calendar"><thead><tr>';var thead="";for(var dow=0;dow<7;dow++){var day=(dow+firstDay)%7;thead+="<th"+((dow+firstDay+6)%7>=5?' class="ui-datepicker-week-end"':"")+'><span title="'+dayNames[day]+'">'+dayNamesMin[day]+"</span></th>"}calender+=thead+"</tr></thead><tbody>";var daysInMonth=this._getDaysInMonth(drawYear,drawMonth);if(drawYear==inst.selectedYear&&drawMonth==inst.selectedMonth){inst.selectedDay=Math.min(inst.selectedDay,daysInMonth)}var leadDays=(this._getFirstDayOfMonth(drawYear,drawMonth)-firstDay+7)%7;var numRows=(isMultiMonth?6:Math.ceil((leadDays+daysInMonth)/7));var printDate=this._daylightSavingAdjust(new Date(drawYear,drawMonth,1-leadDays));for(var dRow=0;dRow<numRows;dRow++){calender+="<tr>";var tbody="";for(var dow=0;dow<7;dow++){var daySettings=(beforeShowDay?beforeShowDay.apply((inst.input?inst.input[0]:null),[printDate]):[true,""]);var otherMonth=(printDate.getMonth()!=drawMonth);var unselectable=otherMonth||!daySettings[0]||(minDate&&printDate<minDate)||(maxDate&&printDate>maxDate);tbody+='<td class="'+((dow+firstDay+6)%7>=5?" ui-datepicker-week-end":"")+(otherMonth?" ui-datepicker-other-month":"")+((printDate.getTime()==selectedDate.getTime()&&drawMonth==inst.selectedMonth&&inst._keyEvent)||(defaultDate.getTime()==printDate.getTime()&&defaultDate.getTime()==selectedDate.getTime())?" "+this._dayOverClass:"")+(unselectable?" "+this._unselectableClass+" ui-state-disabled":"")+(otherMonth&&!showOtherMonths?"":" "+daySettings[1]+(printDate.getTime()>=currentDate.getTime()&&printDate.getTime()<=endDate.getTime()?" "+this._currentClass:"")+(printDate.getTime()==today.getTime()?" ui-datepicker-today":""))+'"'+((!otherMonth||showOtherMonths)&&daySettings[2]?' title="'+daySettings[2]+'"':"")+(unselectable?"":" onclick=\"DP_jQuery.datepicker._selectDay('#"+inst.id+"',"+drawMonth+","+drawYear+', this);return false;"')+">"+(otherMonth?(showOtherMonths?printDate.getDate():" "):(unselectable?'<span class="ui-state-default">'+printDate.getDate()+"</span>":'<a class="ui-state-default'+(printDate.getTime()==today.getTime()?" ui-state-highlight":"")+(printDate.getTime()>=currentDate.getTime()&&printDate.getTime()<=endDate.getTime()?" ui-state-active":"")+'" href="#">'+printDate.getDate()+"</a>"))+"</td>";printDate.setDate(printDate.getDate()+1);printDate=this._daylightSavingAdjust(printDate)}calender+=tbody+"</tr>"}drawMonth++;if(drawMonth>11){drawMonth=0;drawYear++}calender+="</tbody></table>"+(isMultiMonth?"</div>"+((numMonths[0]>0&&col==numMonths[1]-1)?'<div class="ui-datepicker-row-break"></div>':""):"");group+=calender}html+=group}html+=buttonPanel+($.browser.msie&&parseInt($.browser.version,10)<7&&!inst.inline?'<iframe src="javascript:false;" class="ui-datepicker-cover" frameborder="0"></iframe>':"");inst._keyEvent=false;return html},_generateMonthYearHeader:function(inst,drawMonth,drawYear,minDate,maxDate,selectedDate,secondary,monthNames,monthNamesShort){minDate=(inst.rangeStart&&minDate&&selectedDate<minDate?selectedDate:minDate);var changeMonth=this._get(inst,"changeMonth");var changeYear=this._get(inst,"changeYear");var showMonthAfterYear=this._get(inst,"showMonthAfterYear");var html='<div class="ui-datepicker-title">';var monthHtml="";if(secondary||!changeMonth){monthHtml+='<span class="ui-datepicker-month">'+monthNames[drawMonth]+"</span> "}else{var inMinYear=(minDate&&minDate.getFullYear()==drawYear);var inMaxYear=(maxDate&&maxDate.getFullYear()==drawYear);monthHtml+='<select class="ui-datepicker-month" onchange="DP_jQuery.datepicker._selectMonthYear(\'#'+inst.id+"', this, 'M');\" onclick=\"DP_jQuery.datepicker._clickMonthYear('#"+inst.id+"');\">";for(var month=0;month<12;month++){if((!inMinYear||month>=minDate.getMonth())&&(!inMaxYear||month<=maxDate.getMonth())){monthHtml+='<option value="'+month+'"'+(month==drawMonth?' selected="selected"':"")+">"+monthNamesShort[month]+"</option>"}}monthHtml+="</select>"}if(!showMonthAfterYear){html+=monthHtml+((secondary||changeMonth||changeYear)&&(!(changeMonth&&changeYear))?" ":"")}if(secondary||!changeYear){html+='<span class="ui-datepicker-year">'+drawYear+"</span>"}else{var years=this._get(inst,"yearRange").split(":");var year=0;var endYear=0;if(years.length!=2){year=drawYear-10;endYear=drawYear+10}else{if(years[0].charAt(0)=="+"||years[0].charAt(0)=="-"){year=drawYear+parseInt(years[0],10);endYear=drawYear+parseInt(years[1],10)}else{year=parseInt(years[0],10);endYear=parseInt(years[1],10)}}year=(minDate?Math.max(year,minDate.getFullYear()):year);endYear=(maxDate?Math.min(endYear,maxDate.getFullYear()):endYear);html+='<select class="ui-datepicker-year" onchange="DP_jQuery.datepicker._selectMonthYear(\'#'+inst.id+"', this, 'Y');\" onclick=\"DP_jQuery.datepicker._clickMonthYear('#"+inst.id+"');\">";for(;year<=endYear;year++){html+='<option value="'+year+'"'+(year==drawYear?' selected="selected"':"")+">"+year+"</option>"}html+="</select>"}if(showMonthAfterYear){html+=(secondary||changeMonth||changeYear?" ":"")+monthHtml}html+="</div>";return html},_adjustInstDate:function(inst,offset,period){var year=inst.drawYear+(period=="Y"?offset:0);var month=inst.drawMonth+(period=="M"?offset:0);var day=Math.min(inst.selectedDay,this._getDaysInMonth(year,month))+(period=="D"?offset:0);var date=this._daylightSavingAdjust(new Date(year,month,day));var minDate=this._getMinMaxDate(inst,"min",true);var maxDate=this._getMinMaxDate(inst,"max");date=(minDate&&date<minDate?minDate:date);date=(maxDate&&date>maxDate?maxDate:date);inst.selectedDay=date.getDate();inst.drawMonth=inst.selectedMonth=date.getMonth();inst.drawYear=inst.selectedYear=date.getFullYear();if(period=="M"||period=="Y"){this._notifyChange(inst)}},_notifyChange:function(inst){var onChange=this._get(inst,"onChangeMonthYear");if(onChange){onChange.apply((inst.input?inst.input[0]:null),[inst.selectedYear,inst.selectedMonth+1,inst])}},_getNumberOfMonths:function(inst){var numMonths=this._get(inst,"numberOfMonths");return(numMonths==null?[1,1]:(typeof numMonths=="number"?[1,numMonths]:numMonths))},_getMinMaxDate:function(inst,minMax,checkRange){var date=this._determineDate(this._get(inst,minMax+"Date"),null);return(!checkRange||!inst.rangeStart?date:(!date||inst.rangeStart>date?inst.rangeStart:date))},_getDaysInMonth:function(year,month){return 32-new Date(year,month,32).getDate()},_getFirstDayOfMonth:function(year,month){return new Date(year,month,1).getDay()},_canAdjustMonth:function(inst,offset,curYear,curMonth){var numMonths=this._getNumberOfMonths(inst);var date=this._daylightSavingAdjust(new Date(curYear,curMonth+(offset<0?offset:numMonths[1]),1));if(offset<0){date.setDate(this._getDaysInMonth(date.getFullYear(),date.getMonth()))}return this._isInRange(inst,date)},_isInRange:function(inst,date){var newMinDate=(!inst.rangeStart?null:this._daylightSavingAdjust(new Date(inst.selectedYear,inst.selectedMonth,inst.selectedDay)));newMinDate=(newMinDate&&inst.rangeStart<newMinDate?inst.rangeStart:newMinDate);var minDate=newMinDate||this._getMinMaxDate(inst,"min");var maxDate=this._getMinMaxDate(inst,"max");return((!minDate||date>=minDate)&&(!maxDate||date<=maxDate))},_getFormatConfig:function(inst){var shortYearCutoff=this._get(inst,"shortYearCutoff");shortYearCutoff=(typeof shortYearCutoff!="string"?shortYearCutoff:new Date().getFullYear()%100+parseInt(shortYearCutoff,10));return{shortYearCutoff:shortYearCutoff,dayNamesShort:this._get(inst,"dayNamesShort"),dayNames:this._get(inst,"dayNames"),monthNamesShort:this._get(inst,"monthNamesShort"),monthNames:this._get(inst,"monthNames")}},_formatDate:function(inst,day,month,year){if(!day){inst.currentDay=inst.selectedDay;inst.currentMonth=inst.selectedMonth;inst.currentYear=inst.selectedYear}var date=(day?(typeof day=="object"?day:this._daylightSavingAdjust(new Date(year,month,day))):this._daylightSavingAdjust(new Date(inst.currentYear,inst.currentMonth,inst.currentDay)));return this.formatDate(this._get(inst,"dateFormat"),date,this._getFormatConfig(inst))}});function extendRemove(target,props){$.extend(target,props);for(var name in props){if(props[name]==null||props[name]==undefined){target[name]=props[name]}}return target}function isArray(a){return(a&&(($.browser.safari&&typeof a=="object"&&a.length)||(a.constructor&&a.constructor.toString().match(/\Array\(\)/))))}$.fn.datepicker=function(options){if(!$.datepicker.initialized){$(document).mousedown($.datepicker._checkExternalClick).find("body").append($.datepicker.dpDiv);$.datepicker.initialized=true}var otherArgs=Array.prototype.slice.call(arguments,1);if(typeof options=="string"&&(options=="isDisabled"||options=="getDate")){return $.datepicker["_"+options+"Datepicker"].apply($.datepicker,[this[0]].concat(otherArgs))}return this.each(function(){typeof options=="string"?$.datepicker["_"+options+"Datepicker"].apply($.datepicker,[this].concat(otherArgs)):$.datepicker._attachDatepicker(this,options)})};$.datepicker=new Datepicker();$.datepicker.initialized=false;$.datepicker.uuid=new Date().getTime();$.datepicker.version="1.7.1";window.DP_jQuery=$})(jQuery);;/*
- * jQuery UI Progressbar 1.7.1
- *
- * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT (MIT-LICENSE.txt)
- * and GPL (GPL-LICENSE.txt) licenses.
- *
- * http://docs.jquery.com/UI/Progressbar
- *
- * Depends:
- * ui.core.js
- */
(function(a){a.widget("ui.progressbar",{_init:function(){this.element.addClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").attr({role:"progressbar","aria-valuemin":this._valueMin(),"aria-valuemax":this._valueMax(),"aria-valuenow":this._value()});this.valueDiv=a('<div class="ui-progressbar-value ui-widget-header ui-corner-left"></div>').appendTo(this.element);this._refreshValue()},destroy:function(){this.element.removeClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow").removeData("progressbar").unbind(".progressbar");this.valueDiv.remove();a.widget.prototype.destroy.apply(this,arguments)},value:function(b){arguments.length&&this._setData("value",b);return this._value()},_setData:function(b,c){switch(b){case"value":this.options.value=c;this._refreshValue();this._trigger("change",null,{});break}a.widget.prototype._setData.apply(this,arguments)},_value:function(){var b=this.options.value;if(b<this._valueMin()){b=this._valueMin()}if(b>this._valueMax()){b=this._valueMax()}return b},_valueMin:function(){var b=0;return b},_valueMax:function(){var b=100;return b},_refreshValue:function(){var b=this.value();this.valueDiv[b==this._valueMax()?"addClass":"removeClass"]("ui-corner-right");this.valueDiv.width(b+"%");this.element.attr("aria-valuenow",b)}});a.extend(a.ui.progressbar,{version:"1.7.1",defaults:{value:0}})})(jQuery);;/*
- * jQuery UI Effects 1.7.1
- *
- * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT (MIT-LICENSE.txt)
- * and GPL (GPL-LICENSE.txt) licenses.
- *
- * http://docs.jquery.com/UI/Effects/
- */
jQuery.effects||(function(d){d.effects={version:"1.7.1",save:function(g,h){for(var f=0;f<h.length;f++){if(h[f]!==null){g.data("ec.storage."+h[f],g[0].style[h[f]])}}},restore:function(g,h){for(var f=0;f<h.length;f++){if(h[f]!==null){g.css(h[f],g.data("ec.storage."+h[f]))}}},setMode:function(f,g){if(g=="toggle"){g=f.is(":hidden")?"show":"hide"}return g},getBaseline:function(g,h){var i,f;switch(g[0]){case"top":i=0;break;case"middle":i=0.5;break;case"bottom":i=1;break;default:i=g[0]/h.height}switch(g[1]){case"left":f=0;break;case"center":f=0.5;break;case"right":f=1;break;default:f=g[1]/h.width}return{x:f,y:i}},createWrapper:function(f){if(f.parent().is(".ui-effects-wrapper")){return f.parent()}var g={width:f.outerWidth(true),height:f.outerHeight(true),"float":f.css("float")};f.wrap('<div class="ui-effects-wrapper" style="font-size:100%;background:transparent;border:none;margin:0;padding:0"></div>');var j=f.parent();if(f.css("position")=="static"){j.css({position:"relative"});f.css({position:"relative"})}else{var i=f.css("top");if(isNaN(parseInt(i,10))){i="auto"}var h=f.css("left");if(isNaN(parseInt(h,10))){h="auto"}j.css({position:f.css("position"),top:i,left:h,zIndex:f.css("z-index")}).show();f.css({position:"relative",top:0,left:0})}j.css(g);return j},removeWrapper:function(f){if(f.parent().is(".ui-effects-wrapper")){return f.parent().replaceWith(f)}return f},setTransition:function(g,i,f,h){h=h||{};d.each(i,function(k,j){unit=g.cssUnit(j);if(unit[0]>0){h[j]=unit[0]*f+unit[1]}});return h},animateClass:function(h,i,k,j){var f=(typeof k=="function"?k:(j?j:null));var g=(typeof k=="string"?k:null);return this.each(function(){var q={};var o=d(this);var p=o.attr("style")||"";if(typeof p=="object"){p=p.cssText}if(h.toggle){o.hasClass(h.toggle)?h.remove=h.toggle:h.add=h.toggle}var l=d.extend({},(document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle));if(h.add){o.addClass(h.add)}if(h.remove){o.removeClass(h.remove)}var m=d.extend({},(document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle));if(h.add){o.removeClass(h.add)}if(h.remove){o.addClass(h.remove)}for(var r in m){if(typeof m[r]!="function"&&m[r]&&r.indexOf("Moz")==-1&&r.indexOf("length")==-1&&m[r]!=l[r]&&(r.match(/color/i)||(!r.match(/color/i)&&!isNaN(parseInt(m[r],10))))&&(l.position!="static"||(l.position=="static"&&!r.match(/left|top|bottom|right/)))){q[r]=m[r]}}o.animate(q,i,g,function(){if(typeof d(this).attr("style")=="object"){d(this).attr("style")["cssText"]="";d(this).attr("style")["cssText"]=p}else{d(this).attr("style",p)}if(h.add){d(this).addClass(h.add)}if(h.remove){d(this).removeClass(h.remove)}if(f){f.apply(this,arguments)}})})}};function c(g,f){var i=g[1]&&g[1].constructor==Object?g[1]:{};if(f){i.mode=f}var h=g[1]&&g[1].constructor!=Object?g[1]:(i.duration?i.duration:g[2]);h=d.fx.off?0:typeof h==="number"?h:d.fx.speeds[h]||d.fx.speeds._default;var j=i.callback||(d.isFunction(g[1])&&g[1])||(d.isFunction(g[2])&&g[2])||(d.isFunction(g[3])&&g[3]);return[g[0],i,h,j]}d.fn.extend({_show:d.fn.show,_hide:d.fn.hide,__toggle:d.fn.toggle,_addClass:d.fn.addClass,_removeClass:d.fn.removeClass,_toggleClass:d.fn.toggleClass,effect:function(g,f,h,i){return d.effects[g]?d.effects[g].call(this,{method:g,options:f||{},duration:h,callback:i}):null},show:function(){if(!arguments[0]||(arguments[0].constructor==Number||(/(slow|normal|fast)/).test(arguments[0]))){return this._show.apply(this,arguments)}else{return this.effect.apply(this,c(arguments,"show"))}},hide:function(){if(!arguments[0]||(arguments[0].constructor==Number||(/(slow|normal|fast)/).test(arguments[0]))){return this._hide.apply(this,arguments)}else{return this.effect.apply(this,c(arguments,"hide"))}},toggle:function(){if(!arguments[0]||(arguments[0].constructor==Number||(/(slow|normal|fast)/).test(arguments[0]))||(arguments[0].constructor==Function)){return this.__toggle.apply(this,arguments)}else{return this.effect.apply(this,c(arguments,"toggle"))}},addClass:function(g,f,i,h){return f?d.effects.animateClass.apply(this,[{add:g},f,i,h]):this._addClass(g)},removeClass:function(g,f,i,h){return f?d.effects.animateClass.apply(this,[{remove:g},f,i,h]):this._removeClass(g)},toggleClass:function(g,f,i,h){return((typeof f!=="boolean")&&f)?d.effects.animateClass.apply(this,[{toggle:g},f,i,h]):this._toggleClass(g,f)},morph:function(f,h,g,j,i){return d.effects.animateClass.apply(this,[{add:h,remove:f},g,j,i])},switchClass:function(){return this.morph.apply(this,arguments)},cssUnit:function(f){var g=this.css(f),h=[];d.each(["em","px","%","pt"],function(j,k){if(g.indexOf(k)>0){h=[parseFloat(g),k]}});return h}});d.each(["backgroundColor","borderBottomColor","borderLeftColor","borderRightColor","borderTopColor","color","outlineColor"],function(g,f){d.fx.step[f]=function(h){if(h.state==0){h.start=e(h.elem,f);h.end=b(h.end)}h.elem.style[f]="rgb("+[Math.max(Math.min(parseInt((h.pos*(h.end[0]-h.start[0]))+h.start[0],10),255),0),Math.max(Math.min(parseInt((h.pos*(h.end[1]-h.start[1]))+h.start[1],10),255),0),Math.max(Math.min(parseInt((h.pos*(h.end[2]-h.start[2]))+h.start[2],10),255),0)].join(",")+")"}});function b(g){var f;if(g&&g.constructor==Array&&g.length==3){return g}if(f=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(g)){return[parseInt(f[1],10),parseInt(f[2],10),parseInt(f[3],10)]}if(f=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(g)){return[parseFloat(f[1])*2.55,parseFloat(f[2])*2.55,parseFloat(f[3])*2.55]}if(f=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(g)){return[parseInt(f[1],16),parseInt(f[2],16),parseInt(f[3],16)]}if(f=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(g)){return[parseInt(f[1]+f[1],16),parseInt(f[2]+f[2],16),parseInt(f[3]+f[3],16)]}if(f=/rgba\(0, 0, 0, 0\)/.exec(g)){return a.transparent}return a[d.trim(g).toLowerCase()]}function e(h,f){var g;do{g=d.curCSS(h,f);if(g!=""&&g!="transparent"||d.nodeName(h,"body")){break}f="backgroundColor"}while(h=h.parentNode);return b(g)}var a={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0],transparent:[255,255,255]};d.easing.jswing=d.easing.swing;d.extend(d.easing,{def:"easeOutQuad",swing:function(g,h,f,j,i){return d.easing[d.easing.def](g,h,f,j,i)},easeInQuad:function(g,h,f,j,i){return j*(h/=i)*h+f},easeOutQuad:function(g,h,f,j,i){return -j*(h/=i)*(h-2)+f},easeInOutQuad:function(g,h,f,j,i){if((h/=i/2)<1){return j/2*h*h+f}return -j/2*((--h)*(h-2)-1)+f},easeInCubic:function(g,h,f,j,i){return j*(h/=i)*h*h+f},easeOutCubic:function(g,h,f,j,i){return j*((h=h/i-1)*h*h+1)+f},easeInOutCubic:function(g,h,f,j,i){if((h/=i/2)<1){return j/2*h*h*h+f}return j/2*((h-=2)*h*h+2)+f},easeInQuart:function(g,h,f,j,i){return j*(h/=i)*h*h*h+f},easeOutQuart:function(g,h,f,j,i){return -j*((h=h/i-1)*h*h*h-1)+f},easeInOutQuart:function(g,h,f,j,i){if((h/=i/2)<1){return j/2*h*h*h*h+f}return -j/2*((h-=2)*h*h*h-2)+f},easeInQuint:function(g,h,f,j,i){return j*(h/=i)*h*h*h*h+f},easeOutQuint:function(g,h,f,j,i){return j*((h=h/i-1)*h*h*h*h+1)+f},easeInOutQuint:function(g,h,f,j,i){if((h/=i/2)<1){return j/2*h*h*h*h*h+f}return j/2*((h-=2)*h*h*h*h+2)+f},easeInSine:function(g,h,f,j,i){return -j*Math.cos(h/i*(Math.PI/2))+j+f},easeOutSine:function(g,h,f,j,i){return j*Math.sin(h/i*(Math.PI/2))+f},easeInOutSine:function(g,h,f,j,i){return -j/2*(Math.cos(Math.PI*h/i)-1)+f},easeInExpo:function(g,h,f,j,i){return(h==0)?f:j*Math.pow(2,10*(h/i-1))+f},easeOutExpo:function(g,h,f,j,i){return(h==i)?f+j:j*(-Math.pow(2,-10*h/i)+1)+f},easeInOutExpo:function(g,h,f,j,i){if(h==0){return f}if(h==i){return f+j}if((h/=i/2)<1){return j/2*Math.pow(2,10*(h-1))+f}return j/2*(-Math.pow(2,-10*--h)+2)+f},easeInCirc:function(g,h,f,j,i){return -j*(Math.sqrt(1-(h/=i)*h)-1)+f},easeOutCirc:function(g,h,f,j,i){return j*Math.sqrt(1-(h=h/i-1)*h)+f},easeInOutCirc:function(g,h,f,j,i){if((h/=i/2)<1){return -j/2*(Math.sqrt(1-h*h)-1)+f}return j/2*(Math.sqrt(1-(h-=2)*h)+1)+f},easeInElastic:function(g,i,f,m,l){var j=1.70158;var k=0;var h=m;if(i==0){return f}if((i/=l)==1){return f+m}if(!k){k=l*0.3}if(h<Math.abs(m)){h=m;var j=k/4}else{var j=k/(2*Math.PI)*Math.asin(m/h)}return -(h*Math.pow(2,10*(i-=1))*Math.sin((i*l-j)*(2*Math.PI)/k))+f},easeOutElastic:function(g,i,f,m,l){var j=1.70158;var k=0;var h=m;if(i==0){return f}if((i/=l)==1){return f+m}if(!k){k=l*0.3}if(h<Math.abs(m)){h=m;var j=k/4}else{var j=k/(2*Math.PI)*Math.asin(m/h)}return h*Math.pow(2,-10*i)*Math.sin((i*l-j)*(2*Math.PI)/k)+m+f},easeInOutElastic:function(g,i,f,m,l){var j=1.70158;var k=0;var h=m;if(i==0){return f}if((i/=l/2)==2){return f+m}if(!k){k=l*(0.3*1.5)}if(h<Math.abs(m)){h=m;var j=k/4}else{var j=k/(2*Math.PI)*Math.asin(m/h)}if(i<1){return -0.5*(h*Math.pow(2,10*(i-=1))*Math.sin((i*l-j)*(2*Math.PI)/k))+f}return h*Math.pow(2,-10*(i-=1))*Math.sin((i*l-j)*(2*Math.PI)/k)*0.5+m+f},easeInBack:function(g,h,f,k,j,i){if(i==undefined){i=1.70158}return k*(h/=j)*h*((i+1)*h-i)+f},easeOutBack:function(g,h,f,k,j,i){if(i==undefined){i=1.70158}return k*((h=h/j-1)*h*((i+1)*h+i)+1)+f},easeInOutBack:function(g,h,f,k,j,i){if(i==undefined){i=1.70158}if((h/=j/2)<1){return k/2*(h*h*(((i*=(1.525))+1)*h-i))+f}return k/2*((h-=2)*h*(((i*=(1.525))+1)*h+i)+2)+f},easeInBounce:function(g,h,f,j,i){return j-d.easing.easeOutBounce(g,i-h,0,j,i)+f},easeOutBounce:function(g,h,f,j,i){if((h/=i)<(1/2.75)){return j*(7.5625*h*h)+f}else{if(h<(2/2.75)){return j*(7.5625*(h-=(1.5/2.75))*h+0.75)+f}else{if(h<(2.5/2.75)){return j*(7.5625*(h-=(2.25/2.75))*h+0.9375)+f}else{return j*(7.5625*(h-=(2.625/2.75))*h+0.984375)+f}}}},easeInOutBounce:function(g,h,f,j,i){if(h<i/2){return d.easing.easeInBounce(g,h*2,0,j,i)*0.5+f}return d.easing.easeOutBounce(g,h*2-i,0,j,i)*0.5+j*0.5+f}})})(jQuery);;/*
- * jQuery UI Effects Blind 1.7.1
- *
- * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT (MIT-LICENSE.txt)
- * and GPL (GPL-LICENSE.txt) licenses.
- *
- * http://docs.jquery.com/UI/Effects/Blind
- *
- * Depends:
- * effects.core.js
- */
(function(a){a.effects.blind=function(b){return this.queue(function(){var d=a(this),c=["position","top","left"];var h=a.effects.setMode(d,b.options.mode||"hide");var g=b.options.direction||"vertical";a.effects.save(d,c);d.show();var j=a.effects.createWrapper(d).css({overflow:"hidden"});var e=(g=="vertical")?"height":"width";var i=(g=="vertical")?j.height():j.width();if(h=="show"){j.css(e,0)}var f={};f[e]=h=="show"?i:0;j.animate(f,b.duration,b.options.easing,function(){if(h=="hide"){d.hide()}a.effects.restore(d,c);a.effects.removeWrapper(d);if(b.callback){b.callback.apply(d[0],arguments)}d.dequeue()})})}})(jQuery);;/*
- * jQuery UI Effects Bounce 1.7.1
- *
- * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT (MIT-LICENSE.txt)
- * and GPL (GPL-LICENSE.txt) licenses.
- *
- * http://docs.jquery.com/UI/Effects/Bounce
- *
- * Depends:
- * effects.core.js
- */
(function(a){a.effects.bounce=function(b){return this.queue(function(){var e=a(this),l=["position","top","left"];var k=a.effects.setMode(e,b.options.mode||"effect");var n=b.options.direction||"up";var c=b.options.distance||20;var d=b.options.times||5;var g=b.duration||250;if(/show|hide/.test(k)){l.push("opacity")}a.effects.save(e,l);e.show();a.effects.createWrapper(e);var f=(n=="up"||n=="down")?"top":"left";var p=(n=="up"||n=="left")?"pos":"neg";var c=b.options.distance||(f=="top"?e.outerHeight({margin:true})/3:e.outerWidth({margin:true})/3);if(k=="show"){e.css("opacity",0).css(f,p=="pos"?-c:c)}if(k=="hide"){c=c/(d*2)}if(k!="hide"){d--}if(k=="show"){var h={opacity:1};h[f]=(p=="pos"?"+=":"-=")+c;e.animate(h,g/2,b.options.easing);c=c/2;d--}for(var j=0;j<d;j++){var o={},m={};o[f]=(p=="pos"?"-=":"+=")+c;m[f]=(p=="pos"?"+=":"-=")+c;e.animate(o,g/2,b.options.easing).animate(m,g/2,b.options.easing);c=(k=="hide")?c*2:c/2}if(k=="hide"){var h={opacity:0};h[f]=(p=="pos"?"-=":"+=")+c;e.animate(h,g/2,b.options.easing,function(){e.hide();a.effects.restore(e,l);a.effects.removeWrapper(e);if(b.callback){b.callback.apply(this,arguments)}})}else{var o={},m={};o[f]=(p=="pos"?"-=":"+=")+c;m[f]=(p=="pos"?"+=":"-=")+c;e.animate(o,g/2,b.options.easing).animate(m,g/2,b.options.easing,function(){a.effects.restore(e,l);a.effects.removeWrapper(e);if(b.callback){b.callback.apply(this,arguments)}})}e.queue("fx",function(){e.dequeue()});e.dequeue()})}})(jQuery);;/*
- * jQuery UI Effects Clip 1.7.1
- *
- * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT (MIT-LICENSE.txt)
- * and GPL (GPL-LICENSE.txt) licenses.
- *
- * http://docs.jquery.com/UI/Effects/Clip
- *
- * Depends:
- * effects.core.js
- */
(function(a){a.effects.clip=function(b){return this.queue(function(){var f=a(this),j=["position","top","left","height","width"];var i=a.effects.setMode(f,b.options.mode||"hide");var k=b.options.direction||"vertical";a.effects.save(f,j);f.show();var c=a.effects.createWrapper(f).css({overflow:"hidden"});var e=f[0].tagName=="IMG"?c:f;var g={size:(k=="vertical")?"height":"width",position:(k=="vertical")?"top":"left"};var d=(k=="vertical")?e.height():e.width();if(i=="show"){e.css(g.size,0);e.css(g.position,d/2)}var h={};h[g.size]=i=="show"?d:0;h[g.position]=i=="show"?0:d/2;e.animate(h,{queue:false,duration:b.duration,easing:b.options.easing,complete:function(){if(i=="hide"){f.hide()}a.effects.restore(f,j);a.effects.removeWrapper(f);if(b.callback){b.callback.apply(f[0],arguments)}f.dequeue()}})})}})(jQuery);;/*
- * jQuery UI Effects Drop 1.7.1
- *
- * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT (MIT-LICENSE.txt)
- * and GPL (GPL-LICENSE.txt) licenses.
- *
- * http://docs.jquery.com/UI/Effects/Drop
- *
- * Depends:
- * effects.core.js
- */
(function(a){a.effects.drop=function(b){return this.queue(function(){var e=a(this),d=["position","top","left","opacity"];var i=a.effects.setMode(e,b.options.mode||"hide");var h=b.options.direction||"left";a.effects.save(e,d);e.show();a.effects.createWrapper(e);var f=(h=="up"||h=="down")?"top":"left";var c=(h=="up"||h=="left")?"pos":"neg";var j=b.options.distance||(f=="top"?e.outerHeight({margin:true})/2:e.outerWidth({margin:true})/2);if(i=="show"){e.css("opacity",0).css(f,c=="pos"?-j:j)}var g={opacity:i=="show"?1:0};g[f]=(i=="show"?(c=="pos"?"+=":"-="):(c=="pos"?"-=":"+="))+j;e.animate(g,{queue:false,duration:b.duration,easing:b.options.easing,complete:function(){if(i=="hide"){e.hide()}a.effects.restore(e,d);a.effects.removeWrapper(e);if(b.callback){b.callback.apply(this,arguments)}e.dequeue()}})})}})(jQuery);;/*
- * jQuery UI Effects Explode 1.7.1
- *
- * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT (MIT-LICENSE.txt)
- * and GPL (GPL-LICENSE.txt) licenses.
- *
- * http://docs.jquery.com/UI/Effects/Explode
- *
- * Depends:
- * effects.core.js
- */
(function(a){a.effects.explode=function(b){return this.queue(function(){var k=b.options.pieces?Math.round(Math.sqrt(b.options.pieces)):3;var e=b.options.pieces?Math.round(Math.sqrt(b.options.pieces)):3;b.options.mode=b.options.mode=="toggle"?(a(this).is(":visible")?"hide":"show"):b.options.mode;var h=a(this).show().css("visibility","hidden");var l=h.offset();l.top-=parseInt(h.css("marginTop"),10)||0;l.left-=parseInt(h.css("marginLeft"),10)||0;var g=h.outerWidth(true);var c=h.outerHeight(true);for(var f=0;f<k;f++){for(var d=0;d<e;d++){h.clone().appendTo("body").wrap("<div></div>").css({position:"absolute",visibility:"visible",left:-d*(g/e),top:-f*(c/k)}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:g/e,height:c/k,left:l.left+d*(g/e)+(b.options.mode=="show"?(d-Math.floor(e/2))*(g/e):0),top:l.top+f*(c/k)+(b.options.mode=="show"?(f-Math.floor(k/2))*(c/k):0),opacity:b.options.mode=="show"?0:1}).animate({left:l.left+d*(g/e)+(b.options.mode=="show"?0:(d-Math.floor(e/2))*(g/e)),top:l.top+f*(c/k)+(b.options.mode=="show"?0:(f-Math.floor(k/2))*(c/k)),opacity:b.options.mode=="show"?1:0},b.duration||500)}}setTimeout(function(){b.options.mode=="show"?h.css({visibility:"visible"}):h.css({visibility:"visible"}).hide();if(b.callback){b.callback.apply(h[0])}h.dequeue();a("div.ui-effects-explode").remove()},b.duration||500)})}})(jQuery);;/*
- * jQuery UI Effects Fold 1.7.1
- *
- * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT (MIT-LICENSE.txt)
- * and GPL (GPL-LICENSE.txt) licenses.
- *
- * http://docs.jquery.com/UI/Effects/Fold
- *
- * Depends:
- * effects.core.js
- */
(function(a){a.effects.fold=function(b){return this.queue(function(){var e=a(this),k=["position","top","left"];var h=a.effects.setMode(e,b.options.mode||"hide");var o=b.options.size||15;var n=!(!b.options.horizFirst);var g=b.duration?b.duration/2:a.fx.speeds._default/2;a.effects.save(e,k);e.show();var d=a.effects.createWrapper(e).css({overflow:"hidden"});var i=((h=="show")!=n);var f=i?["width","height"]:["height","width"];var c=i?[d.width(),d.height()]:[d.height(),d.width()];var j=/([0-9]+)%/.exec(o);if(j){o=parseInt(j[1],10)/100*c[h=="hide"?0:1]}if(h=="show"){d.css(n?{height:0,width:o}:{height:o,width:0})}var m={},l={};m[f[0]]=h=="show"?c[0]:o;l[f[1]]=h=="show"?c[1]:0;d.animate(m,g,b.options.easing).animate(l,g,b.options.easing,function(){if(h=="hide"){e.hide()}a.effects.restore(e,k);a.effects.removeWrapper(e);if(b.callback){b.callback.apply(e[0],arguments)}e.dequeue()})})}})(jQuery);;/*
- * jQuery UI Effects Highlight 1.7.1
- *
- * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT (MIT-LICENSE.txt)
- * and GPL (GPL-LICENSE.txt) licenses.
- *
- * http://docs.jquery.com/UI/Effects/Highlight
- *
- * Depends:
- * effects.core.js
- */
(function(a){a.effects.highlight=function(b){return this.queue(function(){var e=a(this),d=["backgroundImage","backgroundColor","opacity"];var h=a.effects.setMode(e,b.options.mode||"show");var c=b.options.color||"#ffff99";var g=e.css("backgroundColor");a.effects.save(e,d);e.show();e.css({backgroundImage:"none",backgroundColor:c});var f={backgroundColor:g};if(h=="hide"){f.opacity=0}e.animate(f,{queue:false,duration:b.duration,easing:b.options.easing,complete:function(){if(h=="hide"){e.hide()}a.effects.restore(e,d);if(h=="show"&&a.browser.msie){this.style.removeAttribute("filter")}if(b.callback){b.callback.apply(this,arguments)}e.dequeue()}})})}})(jQuery);;/*
- * jQuery UI Effects Pulsate 1.7.1
- *
- * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT (MIT-LICENSE.txt)
- * and GPL (GPL-LICENSE.txt) licenses.
- *
- * http://docs.jquery.com/UI/Effects/Pulsate
- *
- * Depends:
- * effects.core.js
- */
(function(a){a.effects.pulsate=function(b){return this.queue(function(){var d=a(this);var g=a.effects.setMode(d,b.options.mode||"show");var f=b.options.times||5;var e=b.duration?b.duration/2:a.fx.speeds._default/2;if(g=="hide"){f--}if(d.is(":hidden")){d.css("opacity",0);d.show();d.animate({opacity:1},e,b.options.easing);f=f-2}for(var c=0;c<f;c++){d.animate({opacity:0},e,b.options.easing).animate({opacity:1},e,b.options.easing)}if(g=="hide"){d.animate({opacity:0},e,b.options.easing,function(){d.hide();if(b.callback){b.callback.apply(this,arguments)}})}else{d.animate({opacity:0},e,b.options.easing).animate({opacity:1},e,b.options.easing,function(){if(b.callback){b.callback.apply(this,arguments)}})}d.queue("fx",function(){d.dequeue()});d.dequeue()})}})(jQuery);;/*
- * jQuery UI Effects Scale 1.7.1
- *
- * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT (MIT-LICENSE.txt)
- * and GPL (GPL-LICENSE.txt) licenses.
- *
- * http://docs.jquery.com/UI/Effects/Scale
- *
- * Depends:
- * effects.core.js
- */
(function(a){a.effects.puff=function(b){return this.queue(function(){var f=a(this);var c=a.extend(true,{},b.options);var h=a.effects.setMode(f,b.options.mode||"hide");var g=parseInt(b.options.percent,10)||150;c.fade=true;var e={height:f.height(),width:f.width()};var d=g/100;f.from=(h=="hide")?e:{height:e.height*d,width:e.width*d};c.from=f.from;c.percent=(h=="hide")?g:100;c.mode=h;f.effect("scale",c,b.duration,b.callback);f.dequeue()})};a.effects.scale=function(b){return this.queue(function(){var g=a(this);var d=a.extend(true,{},b.options);var j=a.effects.setMode(g,b.options.mode||"effect");var h=parseInt(b.options.percent,10)||(parseInt(b.options.percent,10)==0?0:(j=="hide"?0:100));var i=b.options.direction||"both";var c=b.options.origin;if(j!="effect"){d.origin=c||["middle","center"];d.restore=true}var f={height:g.height(),width:g.width()};g.from=b.options.from||(j=="show"?{height:0,width:0}:f);var e={y:i!="horizontal"?(h/100):1,x:i!="vertical"?(h/100):1};g.to={height:f.height*e.y,width:f.width*e.x};if(b.options.fade){if(j=="show"){g.from.opacity=0;g.to.opacity=1}if(j=="hide"){g.from.opacity=1;g.to.opacity=0}}d.from=g.from;d.to=g.to;d.mode=j;g.effect("size",d,b.duration,b.callback);g.dequeue()})};a.effects.size=function(b){return this.queue(function(){var c=a(this),n=["position","top","left","width","height","overflow","opacity"];var m=["position","top","left","overflow","opacity"];var j=["width","height","overflow"];var p=["fontSize"];var k=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"];var f=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"];var g=a.effects.setMode(c,b.options.mode||"effect");var i=b.options.restore||false;var e=b.options.scale||"both";var o=b.options.origin;var d={height:c.height(),width:c.width()};c.from=b.options.from||d;c.to=b.options.to||d;if(o){var h=a.effects.getBaseline(o,d);c.from.top=(d.height-c.from.height)*h.y;c.from.left=(d.width-c.from.width)*h.x;c.to.top=(d.height-c.to.height)*h.y;c.to.left=(d.width-c.to.width)*h.x}var l={from:{y:c.from.height/d.height,x:c.from.width/d.width},to:{y:c.to.height/d.height,x:c.to.width/d.width}};if(e=="box"||e=="both"){if(l.from.y!=l.to.y){n=n.concat(k);c.from=a.effects.setTransition(c,k,l.from.y,c.from);c.to=a.effects.setTransition(c,k,l.to.y,c.to)}if(l.from.x!=l.to.x){n=n.concat(f);c.from=a.effects.setTransition(c,f,l.from.x,c.from);c.to=a.effects.setTransition(c,f,l.to.x,c.to)}}if(e=="content"||e=="both"){if(l.from.y!=l.to.y){n=n.concat(p);c.from=a.effects.setTransition(c,p,l.from.y,c.from);c.to=a.effects.setTransition(c,p,l.to.y,c.to)}}a.effects.save(c,i?n:m);c.show();a.effects.createWrapper(c);c.css("overflow","hidden").css(c.from);if(e=="content"||e=="both"){k=k.concat(["marginTop","marginBottom"]).concat(p);f=f.concat(["marginLeft","marginRight"]);j=n.concat(k).concat(f);c.find("*[width]").each(function(){child=a(this);if(i){a.effects.save(child,j)}var q={height:child.height(),width:child.width()};child.from={height:q.height*l.from.y,width:q.width*l.from.x};child.to={height:q.height*l.to.y,width:q.width*l.to.x};if(l.from.y!=l.to.y){child.from=a.effects.setTransition(child,k,l.from.y,child.from);child.to=a.effects.setTransition(child,k,l.to.y,child.to)}if(l.from.x!=l.to.x){child.from=a.effects.setTransition(child,f,l.from.x,child.from);child.to=a.effects.setTransition(child,f,l.to.x,child.to)}child.css(child.from);child.animate(child.to,b.duration,b.options.easing,function(){if(i){a.effects.restore(child,j)}})})}c.animate(c.to,{queue:false,duration:b.duration,easing:b.options.easing,complete:function(){if(g=="hide"){c.hide()}a.effects.restore(c,i?n:m);a.effects.removeWrapper(c);if(b.callback){b.callback.apply(this,arguments)}c.dequeue()}})})}})(jQuery);;/*
- * jQuery UI Effects Shake 1.7.1
- *
- * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT (MIT-LICENSE.txt)
- * and GPL (GPL-LICENSE.txt) licenses.
- *
- * http://docs.jquery.com/UI/Effects/Shake
- *
- * Depends:
- * effects.core.js
- */
(function(a){a.effects.shake=function(b){return this.queue(function(){var e=a(this),l=["position","top","left"];var k=a.effects.setMode(e,b.options.mode||"effect");var n=b.options.direction||"left";var c=b.options.distance||20;var d=b.options.times||3;var g=b.duration||b.options.duration||140;a.effects.save(e,l);e.show();a.effects.createWrapper(e);var f=(n=="up"||n=="down")?"top":"left";var p=(n=="up"||n=="left")?"pos":"neg";var h={},o={},m={};h[f]=(p=="pos"?"-=":"+=")+c;o[f]=(p=="pos"?"+=":"-=")+c*2;m[f]=(p=="pos"?"-=":"+=")+c*2;e.animate(h,g,b.options.easing);for(var j=1;j<d;j++){e.animate(o,g,b.options.easing).animate(m,g,b.options.easing)}e.animate(o,g,b.options.easing).animate(h,g/2,b.options.easing,function(){a.effects.restore(e,l);a.effects.removeWrapper(e);if(b.callback){b.callback.apply(this,arguments)}});e.queue("fx",function(){e.dequeue()});e.dequeue()})}})(jQuery);;/*
- * jQuery UI Effects Slide 1.7.1
- *
- * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT (MIT-LICENSE.txt)
- * and GPL (GPL-LICENSE.txt) licenses.
- *
- * http://docs.jquery.com/UI/Effects/Slide
- *
- * Depends:
- * effects.core.js
- */
(function(a){a.effects.slide=function(b){return this.queue(function(){var e=a(this),d=["position","top","left"];var i=a.effects.setMode(e,b.options.mode||"show");var h=b.options.direction||"left";a.effects.save(e,d);e.show();a.effects.createWrapper(e).css({overflow:"hidden"});var f=(h=="up"||h=="down")?"top":"left";var c=(h=="up"||h=="left")?"pos":"neg";var j=b.options.distance||(f=="top"?e.outerHeight({margin:true}):e.outerWidth({margin:true}));if(i=="show"){e.css(f,c=="pos"?-j:j)}var g={};g[f]=(i=="show"?(c=="pos"?"+=":"-="):(c=="pos"?"-=":"+="))+j;e.animate(g,{queue:false,duration:b.duration,easing:b.options.easing,complete:function(){if(i=="hide"){e.hide()}a.effects.restore(e,d);a.effects.removeWrapper(e);if(b.callback){b.callback.apply(this,arguments)}e.dequeue()}})})}})(jQuery);;/*
- * jQuery UI Effects Transfer 1.7.1
- *
- * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT (MIT-LICENSE.txt)
- * and GPL (GPL-LICENSE.txt) licenses.
- *
- * http://docs.jquery.com/UI/Effects/Transfer
- *
- * Depends:
- * effects.core.js
- */
(function(a){a.effects.transfer=function(b){return this.queue(function(){var f=a(this),h=a(b.options.to),e=h.offset(),g={top:e.top,left:e.left,height:h.innerHeight(),width:h.innerWidth()},d=f.offset(),c=a('<div class="ui-effects-transfer"></div>').appendTo(document.body).addClass(b.options.className).css({top:d.top,left:d.left,height:f.innerHeight(),width:f.innerWidth(),position:"absolute"}).animate(g,b.duration,b.options.easing,function(){c.remove();(b.callback&&b.callback.apply(f[0],arguments));f.dequeue()})})}})(jQuery);;
\ No newline at end of file
deleted file mode 100644
--- a/mail/test/resources/mozmill/mozmill/extension/content/jquery/jquery.ui.core.js
+++ /dev/null
@@ -1,557 +0,0 @@
-/*
- * jQuery UI @VERSION
- *
- * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT (MIT-LICENSE.txt)
- * and GPL (GPL-LICENSE.txt) licenses.
- *
- * http://docs.jquery.com/UI
- */
-;jQuery.ui || (function($) {
-
-var _remove = $.fn.remove,
- isFF2 = $.browser.mozilla && (parseFloat($.browser.version) < 1.9);
-
-//Helper functions and ui object
-$.ui = {
- version: "@VERSION",
-
- // $.ui.plugin is deprecated. Use the proxy pattern instead.
- plugin: {
- add: function(module, option, set) {
- var proto = $.ui[module].prototype;
- for(var i in set) {
- proto.plugins[i] = proto.plugins[i] || [];
- proto.plugins[i].push([option, set[i]]);
- }
- },
- call: function(instance, name, args) {
- var set = instance.plugins[name];
- if(!set || !instance.element[0].parentNode) { return; }
-
- for (var i = 0; i < set.length; i++) {
- if (instance.options[set[i][0]]) {
- set[i][1].apply(instance.element, args);
- }
- }
- }
- },
-
- contains: function(a, b) {
- return document.compareDocumentPosition
- ? a.compareDocumentPosition(b) & 16
- : a !== b && a.contains(b);
- },
-
- hasScroll: function(el, a) {
-
- //If overflow is hidden, the element might have extra content, but the user wants to hide it
- if ($(el).css('overflow') == 'hidden') { return false; }
-
- var scroll = (a && a == 'left') ? 'scrollLeft' : 'scrollTop',
- has = false;
-
- if (el[scroll] > 0) { return true; }
-
- // TODO: determine which cases actually cause this to happen
- // if the element doesn't have the scroll set, see if it's possible to
- // set the scroll
- el[scroll] = 1;
- has = (el[scroll] > 0);
- el[scroll] = 0;
- return has;
- },
-
- isOverAxis: function(x, reference, size) {
- //Determines when x coordinate is over "b" element axis
- return (x > reference) && (x < (reference + size));
- },
-
- isOver: function(y, x, top, left, height, width) {
- //Determines when x, y coordinates is over "b" element
- return $.ui.isOverAxis(y, top, height) && $.ui.isOverAxis(x, left, width);
- },
-
- keyCode: {
- BACKSPACE: 8,
- CAPS_LOCK: 20,
- COMMA: 188,
- CONTROL: 17,
- DELETE: 46,
- DOWN: 40,
- END: 35,
- ENTER: 13,
- ESCAPE: 27,
- HOME: 36,
- INSERT: 45,
- LEFT: 37,
- NUMPAD_ADD: 107,
- NUMPAD_DECIMAL: 110,
- NUMPAD_DIVIDE: 111,
- NUMPAD_ENTER: 108,
- NUMPAD_MULTIPLY: 106,
- NUMPAD_SUBTRACT: 109,
- PAGE_DOWN: 34,
- PAGE_UP: 33,
- PERIOD: 190,
- RIGHT: 39,
- SHIFT: 16,
- SPACE: 32,
- TAB: 9,
- UP: 38
- }
-};
-
-// WAI-ARIA normalization
-if (isFF2) {
- var attr = $.attr,
- removeAttr = $.fn.removeAttr,
- ariaNS = "http://www.w3.org/2005/07/aaa",
- ariaState = /^aria-/,
- ariaRole = /^wairole:/;
-
- $.attr = function(elem, name, value) {
- var set = value !== undefined;
-
- return (name == 'role'
- ? (set
- ? attr.call(this, elem, name, "wairole:" + value)
- : (attr.apply(this, arguments) || "").replace(ariaRole, ""))
- : (ariaState.test(name)
- ? (set
- ? elem.setAttributeNS(ariaNS,
- name.replace(ariaState, "aaa:"), value)
- : attr.call(this, elem, name.replace(ariaState, "aaa:")))
- : attr.apply(this, arguments)));
- };
-
- $.fn.removeAttr = function(name) {
- return (ariaState.test(name)
- ? this.each(function() {
- this.removeAttributeNS(ariaNS, name.replace(ariaState, ""));
- }) : removeAttr.call(this, name));
- };
-}
-
-//jQuery plugins
-$.fn.extend({
- _focus: $.fn.focus,
- focus: function(delay, fn) {
- return typeof delay === 'number'
- ? this.each(function() {
- var elem = this;
- setTimeout(function() {
- $(elem).focus();
- (fn && fn.call(elem));
- }, delay);
- })
- : this._focus.apply(this, arguments);
- },
-
- remove: function() {
- // Safari has a native remove event which actually removes DOM elements,
- // so we have to use triggerHandler instead of trigger (#3037).
- $("*", this).add(this).each(function() {
- $(this).triggerHandler("remove");
- });
- return _remove.apply(this, arguments );
- },
-
- enableSelection: function() {
- return this
- .attr('unselectable', 'off')
- .css('MozUserSelect', '')
- .unbind('selectstart.ui');
- },
-
- disableSelection: function() {
- return this
- .attr('unselectable', 'on')
- .css('MozUserSelect', 'none')
- .bind('selectstart.ui', function() { return false; });
- },
-
- scrollParent: function() {
- var scrollParent;
- if(($.browser.msie && (/(static|relative)/).test(this.css('position'))) || (/absolute/).test(this.css('position'))) {
- scrollParent = this.parents().filter(function() {
- return (/(relative|absolute|fixed)/).test($.curCSS(this,'position',1)) && (/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1));
- }).eq(0);
- } else {
- scrollParent = this.parents().filter(function() {
- return (/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1));
- }).eq(0);
- }
-
- return (/fixed/).test(this.css('position')) || !scrollParent.length ? $(document) : scrollParent;
- },
-
- zIndex: function(zIndex) {
- if (zIndex !== undefined) {
- return this.css('zIndex', zIndex);
- }
-
- var elem = this[0];
- while (elem && elem.style) {
- // IE returns 0 when zIndex is not specified
- // other browsers return an empty string
- // we ignore the case of nested elements with an explicit value of 0
- // <div style="z-index: -10;"><div style="z-index: 0;"></div></div>
- if (elem.style.zIndex !== '' && elem.style.zIndex !== 0) {
- return +elem.style.zIndex;
- }
- elem = elem.parentNode;
- }
-
- return 0;
- }
-});
-
-
-//Additional selectors
-$.extend($.expr[':'], {
- data: function(elem, i, match) {
- return !!$.data(elem, match[3]);
- },
-
- focusable: function(element) {
- var nodeName = element.nodeName.toLowerCase(),
- tabIndex = $.attr(element, 'tabindex');
- return (/input|select|textarea|button|object/.test(nodeName)
- ? !element.disabled
- : 'a' == nodeName || 'area' == nodeName
- ? element.href || !isNaN(tabIndex)
- : !isNaN(tabIndex))
- // the element and all of its ancestors must be visible
- // the browser may report that the area is hidden
- && !$(element)['area' == nodeName ? 'parents' : 'closest'](':hidden').length;
- },
-
- tabbable: function(element) {
- var tabIndex = $.attr(element, 'tabindex');
- return (isNaN(tabIndex) || tabIndex >= 0) && $(element).is(':focusable');
- }
-});
-
-
-// $.widget is a factory to create jQuery plugins
-// taking some boilerplate code out of the plugin code
-$.widget = function(name, prototype) {
- var namespace = name.split(".")[0],
- fullName;
- name = name.split(".")[1];
- fullName = namespace + '-' + name;
-
- // create selector for plugin
- $.expr[':'][fullName] = function(elem) {
- return !!$.data(elem, name);
- };
-
- // create plugin method
- $.fn[name] = function(options) {
- var isMethodCall = (typeof options == 'string'),
- args = Array.prototype.slice.call(arguments, 1),
- returnValue = this;
-
- // allow multiple hashes to be passed on init
- options = !isMethodCall && args.length
- ? $.extend.apply(null, [true, options].concat(args))
- : options;
-
- // prevent calls to internal methods
- if (isMethodCall && options.substring(0, 1) == '_') {
- return returnValue;
- }
-
- (isMethodCall
- ? this.each(function() {
- var instance = $.data(this, name),
- methodValue = (instance && $.isFunction(instance[options])
- ? instance[options].apply(instance, args)
- : instance);
- if (methodValue !== instance && methodValue !== undefined) {
- returnValue = methodValue;
- return false;
- }
- })
- : this.each(function() {
- ($.data(this, name) ||
- $.data(this, name, new $[namespace][name](this, options))._init());
- }));
-
- return returnValue;
- };
-
- // create widget constructor
- $[namespace] = $[namespace] || {};
- $[namespace][name] = function(element, options) {
- var self = this;
-
- this.namespace = namespace;
- this.widgetName = name;
- this.widgetEventPrefix = $[namespace][name].eventPrefix || name;
- this.widgetBaseClass = fullName;
-
- this.options = $.extend(true, {},
- $.widget.defaults,
- $[namespace][name].defaults,
- $.metadata && $.metadata.get(element)[name],
- options);
-
- this.element = $(element)
- .bind('setData.' + name, function(event, key, value) {
- if (event.target == element) {
- return self._setData(key, value);
- }
- })
- .bind('getData.' + name, function(event, key) {
- if (event.target == element) {
- return self._getData(key);
- }
- })
- .bind('remove.' + name, function() {
- return self.destroy();
- });
- };
-
- // add widget prototype
- $[namespace][name].prototype = $.extend({}, $.widget.prototype, prototype);
-};
-
-$.widget.prototype = {
- _init: function() {},
- destroy: function() {
- this.element.removeData(this.widgetName)
- .removeClass(this.widgetBaseClass + '-disabled' + ' ' + this.namespace + '-state-disabled')
- .removeAttr('aria-disabled');
-
- return this;
- },
-
- // override when the widget element is a wrapper or similar
- widget: function() {
- return this.element;
- },
-
- option: function(key, value) {
- var options = key,
- self = this;
-
- if (typeof key == "string") {
- if (value === undefined) {
- return this._getData(key);
- }
- options = {};
- options[key] = value;
- }
-
- $.each(options, function(key, value) {
- self._setData(key, value);
- });
-
- return self;
- },
- _getData: function(key) {
- return this.options[key];
- },
- _setData: function(key, value) {
- this.options[key] = value;
-
- if (key == 'disabled') {
- this.element
- [value ? 'addClass' : 'removeClass'](
- this.widgetBaseClass + '-disabled' + ' ' +
- this.namespace + '-state-disabled')
- .attr("aria-disabled", value);
- }
- },
-
- enable: function() {
- this._setData('disabled', false);
- return this;
- },
- disable: function() {
- this._setData('disabled', true);
- return this;
- },
-
- _trigger: function(type, event, data) {
- var callback = this.options[type];
-
- event = $.Event(event);
- event.type = (type == this.widgetEventPrefix
- ? type : this.widgetEventPrefix + type).toLowerCase();
- data = data || {};
-
- // copy original event properties over to the new event
- // this would happen if we could call $.event.fix instead of $.Event
- // but we don't have a way to force an event to be fixed multiple times
- if (event.originalEvent) {
- for (var i = $.event.props.length, prop; i;) {
- prop = $.event.props[--i];
- event[prop] = event.originalEvent[prop];
- }
- }
-
- this.element.trigger(event, data);
-
- return !($.isFunction(callback) && callback.call(this.element[0], event, data) === false
- || event.isDefaultPrevented());
- }
-};
-
-$.widget.defaults = {
- disabled: false
-};
-
-
-/** Mouse Interaction Plugin **/
-
-$.ui.mouse = {
- _mouseInit: function() {
- var self = this;
-
- this.element
- .bind('mousedown.'+this.widgetName, function(event) {
- return self._mouseDown(event);
- })
- .bind('click.'+this.widgetName, function(event) {
- if(self._preventClickEvent) {
- self._preventClickEvent = false;
- event.stopImmediatePropagation();
- return false;
- }
- });
-
- // Prevent text selection in IE
- if ($.browser.msie) {
- this._mouseUnselectable = this.element.attr('unselectable');
- this.element.attr('unselectable', 'on');
- }
-
- this.started = false;
- },
-
- // TODO: make sure destroying one instance of mouse doesn't mess with
- // other instances of mouse
- _mouseDestroy: function() {
- this.element.unbind('.'+this.widgetName);
-
- // Restore text selection in IE
- ($.browser.msie
- && this.element.attr('unselectable', this._mouseUnselectable));
- },
-
- _mouseDown: function(event) {
- // don't let more than one widget handle mouseStart
- // TODO: figure out why we have to use originalEvent
- event.originalEvent = event.originalEvent || {};
- if (event.originalEvent.mouseHandled) { return; }
-
- // we may have missed mouseup (out of window)
- (this._mouseStarted && this._mouseUp(event));
-
- this._mouseDownEvent = event;
-
- var self = this,
- btnIsLeft = (event.which == 1),
- elIsCancel = (typeof this.options.cancel == "string" ? $(event.target).parents().add(event.target).filter(this.options.cancel).length : false);
- if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) {
- return true;
- }
-
- this.mouseDelayMet = !this.options.delay;
- if (!this.mouseDelayMet) {
- this._mouseDelayTimer = setTimeout(function() {
- self.mouseDelayMet = true;
- }, this.options.delay);
- }
-
- if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
- this._mouseStarted = (this._mouseStart(event) !== false);
- if (!this._mouseStarted) {
- event.preventDefault();
- return true;
- }
- }
-
- // these delegates are required to keep context
- this._mouseMoveDelegate = function(event) {
- return self._mouseMove(event);
- };
- this._mouseUpDelegate = function(event) {
- return self._mouseUp(event);
- };
- $(document)
- .bind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
- .bind('mouseup.'+this.widgetName, this._mouseUpDelegate);
-
- // preventDefault() is used to prevent the selection of text here -
- // however, in Safari, this causes select boxes not to be selectable
- // anymore, so this fix is needed
- ($.browser.safari || event.preventDefault());
-
- event.originalEvent.mouseHandled = true;
- return true;
- },
-
- _mouseMove: function(event) {
- // IE mouseup check - mouseup happened when mouse was out of window
- if ($.browser.msie && !event.button) {
- return this._mouseUp(event);
- }
-
- if (this._mouseStarted) {
- this._mouseDrag(event);
- return event.preventDefault();
- }
-
- if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
- this._mouseStarted =
- (this._mouseStart(this._mouseDownEvent, event) !== false);
- (this._mouseStarted ? this._mouseDrag(event) : this._mouseUp(event));
- }
-
- return !this._mouseStarted;
- },
-
- _mouseUp: function(event) {
- $(document)
- .unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
- .unbind('mouseup.'+this.widgetName, this._mouseUpDelegate);
-
- if (this._mouseStarted) {
- this._mouseStarted = false;
- this._preventClickEvent = (event.target == this._mouseDownEvent.target);
- this._mouseStop(event);
- }
-
- return false;
- },
-
- _mouseDistanceMet: function(event) {
- return (Math.max(
- Math.abs(this._mouseDownEvent.pageX - event.pageX),
- Math.abs(this._mouseDownEvent.pageY - event.pageY)
- ) >= this.options.distance
- );
- },
-
- _mouseDelayMet: function(event) {
- return this.mouseDelayMet;
- },
-
- // These are placeholder methods, to be overriden by extending plugin
- _mouseStart: function(event) {},
- _mouseDrag: function(event) {},
- _mouseStop: function(event) {},
- _mouseCapture: function(event) { return true; }
-};
-
-$.ui.mouse.defaults = {
- cancel: ':input,option',
- distance: 1,
- delay: 0
-};
-
-})(jQuery);
deleted file mode 100644
--- a/mail/test/resources/mozmill/mozmill/extension/content/jquery/jquery.ui.menu.js
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- * jQuery UI Menu @VERSION
- *
- * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT (MIT-LICENSE.txt)
- * and GPL (GPL-LICENSE.txt) licenses.
- *
- * http://docs.jquery.com/UI/Menu
- *
- * Depends:
- * jquery.ui.core.js
- */
-(function($) {
-
-$.widget("ui.menu", {
- _init: function() {
- var self = this;
- this.element.attr("role", "menu")
- .attr("aria-activedescendant", "ui-active-menuitem")
- .addClass("ui-menu ui-widget ui-widget-content ui-corner-bottom")
- .click(function(e) {
- // temporary
- e.preventDefault();
- self.select();
- });
- var items = this.element.children("li");
- items.addClass("ui-menu-item").attr("role", "menuitem")
- .children("a").attr("tabindex", "-1").addClass("ui-corner-all")
- // mouseenter doesn't work with event delegation
- .mouseenter(function() {
- self.activate($(this).parent());
- });
- },
-
- activate: function(item) {
- this.deactivate();
- this.active = item.children("a").addClass("ui-state-hover").attr("id", "ui-active-menuitem").end();
- this._trigger("focus", null, { item: item });
- if (this.hasScroll()) {
- var offset = item.offset().top - this.element.offset().top,
- scroll = this.element.attr("scrollTop"),
- elementHeight = this.element.height();
- if (offset < 0) {
- this.element.attr("scrollTop", scroll + offset);
- } else if (offset > elementHeight) {
- this.element.attr("scrollTop", scroll + offset - elementHeight + item.height());
- }
- }
- },
-
- deactivate: function() {
- if (!this.active)
- return;
- this.active.children("a").removeClass("ui-state-hover").removeAttr("id", "ui-active-menuitem");
- this.active = null;
- },
-
- next: function() {
- this.move("next", "li:first");
- },
-
- previous: function() {
- this.move("prev", "li:last");
- },
-
- first: function() {
- return this.active && !this.active.prev().length;
- },
-
- last: function() {
- return this.active && !this.active.next().length;
- },
-
- move: function(direction, edge) {
- if (!this.active) {
- this.activate(this.element.children(edge));
- return;
- }
- var next = this.active[direction]();
- if (next.length) {
- this.activate(next);
- } else {
- this.activate(this.element.children(edge));
- }
- },
-
- // TODO merge with previousPage
- nextPage: function() {
- if (this.hasScroll()) {
- // TODO merge with no-scroll-else
- if (!this.active || this.last()) {
- this.activate(this.element.children(":first"));
- return;
- }
- // last item on page, then scroll one page down, otherwise select last item on page
- if (this.active && this.active.offset().top - this.element.offset().top + this.active.height() > this.element.height()) {
- // last
- var offsetBase = this.element.offset().top,
- height = this.element.height();
- var result = this.element.children("li").filter(function() {
- var close = $(this).offset().top - offsetBase - height * 1.5 - $(this).height() / 2;
- // TODO improve approximation
- return close < 10 && close > -10;
- })
- // TODO try to catch this earlier when scrollTop indicates the last page anyway
- if (!result.length)
- result = this.element.children(":last")
- this.activate(result);
- } else {
- // not last
- var offsetBase = this.element.offset().top,
- height = this.element.height();
- var result = this.element.children("li").filter(function() {
- var close = $(this).offset().top - offsetBase + $(this).height() - height;
- // TODO improve approximation
- return close < 10 && close > -10;
- })
- this.activate(result);
- }
- } else {
- this.activate(this.element.children(!this.active || this.last() ? ":first" : ":last"));
- }
- },
-
- // TODO merge with nextPage
- previousPage: function() {
- if (this.hasScroll()) {
- // TODO merge with no-scroll-else
- if (!this.active || this.first()) {
- this.activate(this.element.children(":last"));
- return;
- }
- // first item on page, then scroll one page up, otherwise select first item on page
- if (this.active && this.active.offset().top - this.element.offset().top <= 1) {
- // first
- var offsetBase = this.element.offset().top,
- height = this.element.height();
- var result = this.element.children("li").filter(function() {
- var close = $(this).offset().top - offsetBase + height / 2 + $(this).height() / 2;
- // TODO improve approximation
- return close < 10 && close > -10;
- })
- // TODO try to catch this earlier when scrollTop indicates the first page anyway
- if (!result.length)
- result = this.element.children(":first")
- this.activate(result);
- } else {
- // not first
- var offsetBase = this.element.offset().top,
- height = this.element.height();
- var result = this.element.children("li").filter(function() {
- var close = $(this).offset().top - offsetBase;
- // TODO improve approximation
- return close < 10 && close > -10;
- })
- this.activate(result);
- }
- } else {
- this.activate(this.element.children(!this.active || this.first() ? ":last" : ":first"));
- }
- },
-
- hasScroll: function() {
- return this.element.height() < this.element.attr("scrollHeight");
- },
-
- select: function() {
- this._trigger("selected", null, { item: this.active });
- }
-
-});
-
-})(jQuery);
deleted file mode 100644
--- a/mail/test/resources/mozmill/mozmill/extension/content/menus.js
+++ /dev/null
@@ -1,156 +0,0 @@
-// ***** BEGIN LICENSE BLOCK *****
-// Version: MPL 1.1/GPL 2.0/LGPL 2.1
-//
-// The contents of this file are subject to the Mozilla Public License Version
-// 1.1 (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-// http://www.mozilla.org/MPL/
-//
-// Software distributed under the License is distributed on an "AS IS" basis,
-// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-// for the specific language governing rights and limitations under the
-// License.
-//
-// The Original Code is Mozilla Corporation Code.
-//
-// The Initial Developer of the Original Code is
-// Adam Christian.
-// Portions created by the Initial Developer are Copyright (C) 2008
-// the Initial Developer. All Rights Reserved.
-//
-// Contributor(s):
-// Adam Christian <adam.christian@gmail.com>
-// Mikeal Rogers <mikeal.rogers@gmail.com>
-//
-// Alternatively, the contents of this file may be used under the terms of
-// either the GNU General Public License Version 2 or later (the "GPL"), or
-// the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-// in which case the provisions of the GPL or the LGPL are applicable instead
-// of those above. If you wish to allow use of your version of this file only
-// under the terms of either the GPL or the LGPL, and not to allow others to
-// use your version of this file under the terms of the MPL, indicate your
-// decision by deleting the provisions above and replace them with the notice
-// and other provisions required by the GPL or the LGPL. If you do not delete
-// the provisions above, a recipient may use your version of this file under
-// the terms of any one of the MPL, the GPL or the LGPL.
-//
-// ***** END LICENSE BLOCK *****
-
-var frame = {}; Components.utils.import('resource://mozmill/modules/frame.js', frame);
-
-
-function getBasename(path){
- var splt = "/"
- if (navigator.platform.indexOf("Win") != -1){
- splt = "\\";
- }
- var pathArr = path.split(splt);
- return pathArr[pathArr.length-1]
-}
-
-function openFile(){
- var openObj = utils.openFile(window);
- if (openObj) {
- $("#tabs").tabs("select", 0);
- var index = editor.getTabForFile(openObj.path);
- if(index != -1)
- editor.switchTab(index);
- else
- editor.openNew(openObj.data, openObj.path);
- }
-}
-
-function saveAsFile() {
- var content = editor.getContent();
- var filename = utils.saveAsFile(window, content);
- if (filename) {
- $("#tabs").tabs("select", 0);
- editor.changeFilename(filename);
- saveToFile();
- return true;
- }
- return false;
-}
-
-function saveToFile() {
- var filename = editor.getFilename();
- var content = editor.getContent();
- utils.saveFile(window, content, filename);
- editor.onFileSaved();
-}
-
-function saveFile() {
- var filename = editor.getFilename();
- if(/mozmill\.utils\.temp/.test(filename))
- saveAsFile();
- else {
- saveToFile();
- }
-}
-
-function closeFile() {
- $("#tabs").tabs("select", 0);
- var really = confirm("Are you sure you want to close this file?");
- if (really == true)
- editor.closeCurrentTab();
-}
-
-function runFile(){
- var nsIFilePicker = Components.interfaces.nsIFilePicker;
- var fp = Components.classes["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
- fp.init(window, "Select a File", nsIFilePicker.modeOpen);
- fp.appendFilter("JavaScript Files","*.js");
- var res = fp.show();
- if (res == nsIFilePicker.returnOK){
- $("#tabs").tabs("select", 1);
- frame.runTestFile(fp.file.path, true);
- }
- testFinished();
-}
-
-function runDirectory(){
- var nsIFilePicker = Components.interfaces.nsIFilePicker;
- var fp = Components.classes["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
- fp.init(window, "Select a Directory", nsIFilePicker.modeGetFolder);
- var res = fp.show();
- if (res == nsIFilePicker.returnOK){
- $("#tabs").tabs("select", 1);
- frame.runTestDirectory(fp.file.path, true);
- }
- testFinished();
-}
-
-function runEditor(){
- saveToFile();
- var filename = editor.getFilename();
- frame.runTestFile(filename);
- testFinished();
-}
-
-function newFile(){
- editor.openNew();
-}
-
-function newTemplate(){
- var template = "var setupModule = function(module) {\n" +
- " module.controller = mozmill.getBrowserController();\n" +
- "}\n" +
- "\n" +
- "var testFoo = function(){\n" +
- " controller.open('http://www.google.com');\n" +
- "}\n";
- editor.openNew(template);
-}
-
-function tabSelected(selector) {
- editor.switchTab(selector.selectedIndex);
-}
-
-function openHelp() {
- var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
- .getService(Components.interfaces.nsIWindowMediator);
- var browser = wm.getMostRecentWindow("navigator:browser").gBrowser;
- browser.selectedTab =
- browser.addTab("http://quality.mozilla.org/docs/mozmill/getting-started/");
-}
-
deleted file mode 100644
--- a/mail/test/resources/mozmill/mozmill/extension/content/mozmill.html
+++ /dev/null
@@ -1,134 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
- "http://www.w3.org/TR/html4/strict.dtd">
-
-<html lang="en">
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <title>MozMill IDE</title>
- <meta name="generator" content="TextMate http://macromates.com/">
- <meta name="author" content="adam">
- <!-- Date: 2009-02-03 -->
- <link type="text/css" href="css/smoothness/jquery-ui-1.7.1.custom.css" rel="Stylesheet" />
- <link type="text/css" href="css/mozmill.css" rel="Stylesheet" />
- <link type="text/css" href="css/fg.menu.css" rel="Stylesheet"/>
-
- <link id="bespin_base" href="editor/bespin">
- <link href="editor/bespin/BespinEmbedded.css" type="text/css" rel="stylesheet">
- <script type="text/javascript" src="editor/bespin/BespinEmbedded.js"></script>
-
- <script src="mozmill.js"></script>
- <script src="output.js"></script>
- <script src="dx.js"></script>
- <script src="rec.js"></script>
- <script src="menus.js"></script>
- <script src="editor/editor.js"></script>
-
- <script src="jquery/jquery-1.3.2.min.js"></script>
- <script src="jquery/jquery-ui-1.7.1.custom.min.js"></script>
- <script src="ui.js"></script>
- <script src="jquery/fg.menu.js"></script>
-
-</head>
-<body onload=""onunload="cleanUp();">
- <script src="shortcuts.js"></script>
- <script type="text/javascript">
- var syncHeights = function() {
- $('#tabs')[0].style.height = window.innerHeight - 8 + "px";
- $('#resOut')[0].style.height = window.innerHeight - 150 + "px";
- $('#shellOutput')[0].style.height = window.innerHeight - 200 + "px";
- editor.resize(window.innerWidth - 40, window.innerHeight - 108);
- }
-
- window.onresize = function(){ syncHeights(); }
- window.onBespinLoad = function() { newTemplate(); }
-
- $(function() {
- $("#tabs").tabs();
-
- syncHeights();
-
- $('#tabs').bind('tabsshow', function(event, ui) {
- syncHeights();
- });
-
- $('#fileMenu').menu({
- content: $('#fileMenulist').html(),
- showSpeed: 120
- });
- });
- </script>
- <div id="tabs">
- <ul>
- <li><a id="editorTab" href="#tabs-1">Editor</a></li>
- <li><a id="outputTab" href="#tabs-2">Output</a></li>
- <li><a id="eventsTab" href="#tabs-3">Inspector</a></li>
- <li><a id="shellTab" href="#tabs-4">Shell</a></li>
- </ul>
- <div id="tabs-1" class="tab">
- <div id="fileMenuButton"><span tabindex="0" class="menu" id="fileMenu"><u>A</u>ctions</span></div>
- <div style="display:none;">
- <ul id="fileMenulist">
- <li class="menuitem" onclick="openFile();"><a href="#" ><u>O</u>pen</a></li>
- <li class="menuitem" onclick="newTemplate();"><a href="#"><u>N</u>ew</li>
- <li class="menuitem" onclick="saveFile();"><a href="#" ><u>S</u>ave</a></li>
- <li class="menuitem" onclick="saveAsFile();"><a href="#">Sav<u>e</u> As</a></li>
- <li class="menuitem" onclick="closeFile();"><a href="#" >Close C<u>u</u>rrent File</a></li>
- <li class="menuitem" onclick="runFile();"><a href="#">Run <u>F</u>ile</a></li>
- <li class="menuitem" onclick="runDirectory();"><a href="#">Run Direc<u>t</u>ory</a></li>
- <li class="menuitem" onclick="openHelp();"><a href="#"><u>H</u>elp</a></li>
- </ul>
- </div>
- <span id="openTabs"><span id="openTabsLabel">Open Files: </span><select id="editor-tab-select" onchange="tabSelected(this);"></select></span>
- <span style="float:right;">
- <button id="runButton" class="ui-state-default ui-corner-all" onclick="runEditor();"><u>R</u>un</button>
- <button id="recordToggle" class="ui-state-default ui-corner-all" onclick="MozMillrec.toggle();">Recor<u>d</u></button>
- </span>
- <div id="editors"></div>
- </div>
- <div id="tabs-2" class="tab">
- <div id="outOptions" >
- <span id="outToggles">
- Pass:<input id="outPass" label="Pass" type=checkbox checked onchange="updateOutput();"/>
- Fail:<input id="outFail" label="Fail" type=checkbox checked onchange="updateOutput();"/>
- Test:<input id="outTest" label="Test" type=checkbox checked onchange="updateOutput();"/>
- </span>
- <button id="outClear" style="float:right;" class="ui-state-default ui-corner-all" onclick="logicalClear();">C<u>l</u>ear</button>
- </div>
- <p>
- <div id="resOut" style="overflow:auto;position:absolute;height:90%;width:98%"></div>
- </p>
- </div>
- <div id="tabs-3" class="tab">
- <div id="dxOptions" style="float:right;">
- Double Click: <input id="inspectDouble" type="radio" name="inspectClickSelection" value="double" onclick="MozMilldx.changeClick();" checked>
- Single Click: <input id="inspectSingle" type="radio" name="inspectClickSelection" onclick="MozMilldx.changeClick();" value="single">
- </div>
- <br>
- <div id="dxContainer"><div id="elementStr">
- <strong>Element</strong>:
- <span ondblclick="copyToClipboard(this.textContent);" id="dxElement"></span></div>
-
- <span id="controllerStr"><strong>Controller</strong>:
- <span ondblclick="copyToClipboard(this.textContent);" id="dxController"></span></span>
- <br> <div class="ui-helper-hidden">
- <strong>Validation</strong>:
- <span ondblclick="copyToClipboard(this.textContent);" id="dxValidation"></span> </div>
- </div>
- <div id="dxButtons">
- <button id="dxToggle" class="ui-state-default ui-corner-all ui-priority-primary" onclick="MozMilldx.dxToggle();">Start</button>
- <button id="dxCopy" class="ui-state-default ui-corner-all ui-helper-hidden" onclick="copyInspector();">Send To Clipboard</button>
- </div>
- </p>
- </div>
- <div id="tabs-4" class="tab">
- <p>
- <textarea id="shellInput">Type commands here...</textarea>
- <div id="shellOutput">
- </div>
- </p>
- </div>
- </div>
- <script src="shell.js"></script>
- </div>
-</body>
-</html>
deleted file mode 100644
--- a/mail/test/resources/mozmill/mozmill/extension/content/mozmill.js
+++ /dev/null
@@ -1,77 +0,0 @@
-// ***** BEGIN LICENSE BLOCK *****
-// Version: MPL 1.1/GPL 2.0/LGPL 2.1
-//
-// The contents of this file are subject to the Mozilla Public License Version
-// 1.1 (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-// http://www.mozilla.org/MPL/
-//
-// Software distributed under the License is distributed on an "AS IS" basis,
-// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-// for the specific language governing rights and limitations under the
-// License.
-//
-// The Original Code is Mozilla Corporation Code.
-//
-// The Initial Developer of the Original Code is
-// Adam Christian.
-// Portions created by the Initial Developer are Copyright (C) 2008
-// the Initial Developer. All Rights Reserved.
-//
-// Contributor(s):
-// Adam Christian <adam.christian@gmail.com>
-// Mikeal Rogers <mikeal.rogers@gmail.com>
-//
-// Alternatively, the contents of this file may be used under the terms of
-// either the GNU General Public License Version 2 or later (the "GPL"), or
-// the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-// in which case the provisions of the GPL or the LGPL are applicable instead
-// of those above. If you wish to allow use of your version of this file only
-// under the terms of either the GPL or the LGPL, and not to allow others to
-// use your version of this file under the terms of the MPL, indicate your
-// decision by deleting the provisions above and replace them with the notice
-// and other provisions required by the GPL or the LGPL. If you do not delete
-// the provisions above, a recipient may use your version of this file under
-// the terms of any one of the MPL, the GPL or the LGPL.
-//
-// ***** END LICENSE BLOCK *****
-
-var mozmill = {}; Components.utils.import('resource://mozmill/modules/mozmill.js', mozmill);
-var utils = {}; Components.utils.import('resource://mozmill/modules/utils.js', utils);
-
-var updateOutput = function(){
- //get the checkboxes
- var pass = document.getElementById('outPass');
- var fail = document.getElementById('outFail');
- var info = document.getElementById('outTest');
-
- //get the collections
- var passCollect = window.document.getElementsByClassName('pass');
- var failCollect = window.document.getElementsByClassName('fail');
- var infoCollect = window.document.getElementsByClassName('test');
-
- //set the htmlcollection display property in accordance item.checked
- var setDisplay = function(item, collection){
- for (var i = 0; i < collection.length; i++){
- if (item.checked == true){
- collection[i].style.display = "block";
- } else {
- collection[i].style.display = "none";
- }
- }
- };
-
- setDisplay(pass, passCollect);
- setDisplay(fail, failCollect);
- setDisplay(info, infoCollect);
-};
-
-function cleanUp(){
- //cleanup frame event listeners for output
- removeStateListeners();
- // Just store width and height
- utils.setPreference("mozmill.screenX", window.screenX);
- utils.setPreference("mozmill.screenY", window.screenY);
- utils.setPreference("mozmill.width", window.document.documentElement.clientWidth);
- utils.setPreference("mozmill.height", window.document.documentElement.clientHeight);
-}
deleted file mode 100644
--- a/mail/test/resources/mozmill/mozmill/extension/content/mozmill.xul
+++ /dev/null
@@ -1,50 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- ***** BEGIN LICENSE BLOCK *****
- - Version: MPL 1.1/GPL 2.0/LGPL 2.1
- -
- - The contents of this file are subject to the Mozilla Public License Version
- - 1.1 (the "License"); you may not use this file except in compliance with
- - the License. You may obtain a copy of the License at
- - http://www.mozilla.org/MPL/
- -
- - Software distributed under the License is distributed on an "AS IS" basis,
- - WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- - for the specific language governing rights and limitations under the
- - License.
- -
- - The Original Code is MozMill.
- -
- - The Initial Developer of the Original Code is
- - Mozilla Foundation.
- - Portions created by the Initial Developer are Copyright (C) 2009
- - the Initial Developer. All Rights Reserved.
- -
- - Contributor(s): Heather Arthur <harthur@cmu.edu>
- -
- - Alternatively, the contents of this file may be used under the terms of
- - either the GNU General Public License Version 2 or later (the "GPL"), or
- - the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- - in which case the provisions of the GPL or the LGPL are applicable instead
- - of those above. If you wish to allow use of your version of this file only
- - under the terms of either the GPL or the LGPL, and not to allow others to
- - use your version of this file under the terms of the MPL, indicate your
- - decision by deleting the provisions above and replace them with the notice
- - and other provisions required by the GPL or the LGPL. If you do not delete
- - the provisions above, a recipient may use your version of this file under
- - the terms of any one of the MPL, the GPL or the LGPL.
- -
- - ***** END LICENSE BLOCK ***** -->
-<?xml-stylesheet href="chrome://mozmill/skin/chrome.css" type="text/css"?>
-<window id="mozmill-window"
- title="MozMill IDE"
- windowtype="mozmill:ide"
- xmlns:html="http://www.w3.org/1999/xhtml"
- xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
- persist="width height screenX screenY">
-
- <script type="application/x-javascript" src="chrome://mozmill/content/chrome.js"/>
- <tooltip id="mozmill-tooltip" onpopupshowing="return fillTooltip(document.tooltipNode);"/>
-
- <iframe id="mozmill-iframe" src="mozmill.html" flex="1"
- tooltip="mozmill-tooltip" onkeypress="onkeypress"/>
-</window>
deleted file mode 100644
--- a/mail/test/resources/mozmill/mozmill/extension/content/output.js
+++ /dev/null
@@ -1,203 +0,0 @@
-// ***** BEGIN LICENSE BLOCK *****
-// Version: MPL 1.1/GPL 2.0/LGPL 2.1
-//
-// The contents of this file are subject to the Mozilla Public License Version
-// 1.1 (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-// http://www.mozilla.org/MPL/
-//
-// Software distributed under the License is distributed on an "AS IS" basis,
-// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-// for the specific language governing rights and limitations under the
-// License.
-//
-// The Original Code is Mozilla Corporation Code.
-//
-// The Initial Developer of the Original Code is
-// Adam Christian.
-// Portions created by the Initial Developer are Copyright (C) 2008
-// the Initial Developer. All Rights Reserved.
-//
-// Contributor(s):
-// Adam Christian <adam.christian@gmail.com>
-// Mikeal Rogers <mikeal.rogers@gmail.com>
-//
-// Alternatively, the contents of this file may be used under the terms of
-// either the GNU General Public License Version 2 or later (the "GPL"), or
-// the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-// in which case the provisions of the GPL or the LGPL are applicable instead
-// of those above. If you wish to allow use of your version of this file only
-// under the terms of either the GPL or the LGPL, and not to allow others to
-// use your version of this file under the terms of the MPL, indicate your
-// decision by deleting the provisions above and replace them with the notice
-// and other provisions required by the GPL or the LGPL. If you do not delete
-// the provisions above, a recipient may use your version of this file under
-// the terms of any one of the MPL, the GPL or the LGPL.
-//
-// ***** END LICENSE BLOCK *****
-
-var arrays = {}; Components.utils.import('resource://mozmill/stdlib/arrays.js', arrays);
-var json2 = {}; Components.utils.import('resource://mozmill/stdlib/json2.js', json2);
-var utils = {}; Components.utils.import('resource://mozmill/modules/utils.js', utils);
-
-var aConsoleService = Components.classes["@mozilla.org/consoleservice;1"].
- getService(Components.interfaces.nsIConsoleService);
-
-
-var createCell = function (t, obj, message) {
- // try {
- // alert(json2.JSON.stringify(message.exception.message));
- // } catch(err){}
- // //alert(msgObj.exception.message);
- //
- var r = document.getElementById("resOut");
- var msg = document.createElement('div');
- msg.setAttribute("class", t);
- if (t == "fail"){
- $(msg).addClass("ui-state-error ui-corner-all");
- }
- if (t == "pass"){
- $(msg).addClass("ui-state-highlight ui-corner-all");
- msg.style.background = "lightgreen";
- msg.style.border = "1px solid darkgreen";
- }
- else {
- $(msg).addClass("ui-state-highlight ui-corner-all");
- }
- msg.style.height = "15px";
- msg.style.overflow = "hidden";
-
- //if message isn't an object
- if (typeof(message) == "string"){
- msg.innerHTML = "<strong>"+t+"</strong>"+' :: '+message;
- }
- else {
- try {
- var display = message.exception.message;
- if (display == undefined) {
- var display = message.exception;
- }
- } catch(err){
- var display = message['function'];
- }
- //add each piece in its own hbox
- msg.innerHTML = '<span style="float:right;top:0px;cursor: pointer;" class="ui-icon ui-icon-triangle-1-s"/>';
- msg.innerHTML += "<strong>"+t+"</strong>"+' :: '+display;
-
- var createTree = function(obj){
- var mainDiv = document.createElement('div');
- for (prop in obj){
- var newDiv = document.createElement('div');
- newDiv.style.position = "relative";
- newDiv.style.height = "15px";
- newDiv.style.overflow = "hidden";
- newDiv.style.width = "95%";
- newDiv.style.left = "10px";
- //some properties don't have a length attib
- try {
- if (obj[prop] && obj[prop].length > 50){
- newDiv.innerHTML = '<span style="float:right;top:0px;cursor: pointer;" class="ui-icon ui-icon-triangle-1-s"/>';
- }
- } catch(e){}
-
- newDiv.innerHTML += "<strong>"+prop+"</strong>: "+obj[prop];
- mainDiv.appendChild(newDiv);
- }
- return mainDiv;
- }
- //iterate the properties creating output entries for them
- for (prop in message){
- if (typeof message[prop] == "object"){
- var newDiv = createTree(message[prop]);
- }
- else {
- var newDiv = document.createElement('div');
- newDiv.innerHTML = "<strong>"+prop+"</strong>: "+message[prop];
- }
- newDiv.style.position = "relative";
- newDiv.style.left = "10px";
- newDiv.style.overflow = "hidden";
-
- msg.appendChild(newDiv);
- }
-
- }
-
- //Add the event listener for clicking on the box to see more info
- msg.addEventListener('click', function(e){
- // if (e.which == 3){
- // var rout = document.getElementById('resOut');
- // if (e.target.parentNode != rout){
- // copyToClipboard(e.target.parentNode.innerHTML);
- // }
- // else {
- // copyToClipboard(e.target.innerHTML);
- // }
- // alert('Copied to clipboard...')
- // return;
- // }
- if (e.target.tagName == "SPAN"){
- if (e.target.parentNode.style.height == "15px"){
- e.target.parentNode.style.overflow = "";
- e.target.parentNode.style.height = "";
- e.target.className = "ui-icon ui-icon-triangle-1-n";
- }
- else {
- e.target.parentNode.style.height = "15px";
- e.target.parentNode.style.overflow = "hidden";
- e.target.className = "ui-icon ui-icon-triangle-1-s";
- }
- }
-
- }, true);
-
- if (r.childNodes.length == 0){
- r.appendChild(msg);
- }
- else {
- r.insertBefore(msg, r.childNodes[0]);
- }
- updateOutput();
-}
-
-var frame = {}; Components.utils.import('resource://mozmill/modules/frame.js', frame);
-// var utils = {}; Components.utils.import('resouce://mozmill/modules/utils.js', utils);
-
-// Set UI Listeners in frame
-
-function stateListener (state) {
- if (state != 'test') {
- // utils.getWindowByTitle('MozMill IDE').document.getElementById('runningStatus').innerHTML = state;
- }
-}
-frame.events.addListener('setState', stateListener);
-aConsoleService.logStringMessage('+++++++++++++++++++++++');
-aConsoleService.logStringMessage("Current setStateListener size: "+String(frame.events.listeners.setState.length) );
-function testListener (test) {
- createCell('test', test, 'Started running test: '+test.name);
-}
-frame.events.addListener('setTest', testListener);
-function passListener (text) {
- createCell('pass', text, text);
-}
-frame.events.addListener('pass', passListener);
-function failListener (text) {
- createCell('fail', text, text);
-}
-frame.events.addListener('fail', failListener);
-function logListener (obj) {
- createCell('log', obj, obj);
-}
-frame.events.addListener('log', logListener);
-function loggerListener (obj) {
- createCell('logger', obj, obj)
-}
-frame.events.addListener('logger', loggerListener);
-
-function removeStateListeners(){
- frame.events.removeListener(testListener);
- frame.events.removeListener(passListener);
- frame.events.removeListener(failListener);
- frame.events.removeListener(logListener);
- frame.events.removeListener(loggerListener);
-}
deleted file mode 100644
--- a/mail/test/resources/mozmill/mozmill/extension/content/overlay.js
+++ /dev/null
@@ -1,86 +0,0 @@
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Mozilla Corporation Code.
- *
- * The Initial Developer of the Original Code is
- * Adam Christian.
- * Portions created by the Initial Developer are Copyright (C) 2008
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- * Adam Christian <adam.christian@gmail.com>
- * Mikeal Rogers <mikeal.rogers@gmail.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-var mozmillInit = {}; Components.utils.import('resource://mozmill/modules/init.js', mozmillInit);
-
-var MozMill = {
- onLoad: function() {
- // initialization code
- this.initialized = true;
- },
-
- onMenuItemCommand: function() {
- var utils = {}; Components.utils.import('resource://mozmill/modules/utils.js', utils);
- var mmWindows = utils.getWindowByTitle('MozMill IDE');
- if (!mmWindows){
- var height = utils.getPreference("mozmill.height", 740);
- var width = utils.getPreference("mozmill.width", 635);
- //move to top left corner
- var left = utils.getPreference("mozmill.screenX", 0);
- var top = utils.getPreference("mozmill.screenY", 0);
-
- if (left == 0){
- //make only browser windows big
- var width = window.screen.availWidth/2.5;
- var height = window.screen.availHeight;
- window.resizeTo((window.screen.availWidth - width), window.screen.availHeight);
-
- var height = window.innerHeight;
- var left = window.innerWidth;
- }
-
- var paramString = "chrome,resizable,height=" + height +
- ",width=" + width + ",left="+left+",top="+top;
- var w = window.open("chrome://mozmill/content/mozmill.xul", "", paramString);
- } else { mmWindows[0].focus(); }
- }
-};
-
-window.addEventListener("load", function(e) { MozMill.onLoad(e); }, false);
-
-
-function mozMillTestWindow() {
- window.openDialog("chrome://mozmill/content/testwindow.html", "_blank", "chrome,dialog=no, resizable");
-}
-
-//adding a mozmill keyboard shortcut
-// window.addEventListener("keypress", function(e) {
-// if ((e.charCode == 109) && (e.ctrlKey)) {
-// MozMill.onMenuItemCommand(e);
-// }
-// }, false);
deleted file mode 100644
--- a/mail/test/resources/mozmill/mozmill/extension/content/overlay.xul
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0"?>
-<?xml-stylesheet href="chrome://mozmill/skin/overlay.css" type="text/css"?>
-<!DOCTYPE overlay SYSTEM "chrome://mozmill/locale/overlay.dtd">
-<overlay id="mozmill-overlay"
- xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
- <script src="chrome://mozmill/content/overlay.js"/>
-
- <keyset>
- <key id="open-mozmill" modifiers="accel shift" key="m" oncommand="MozMill.onMenuItemCommand(event);"/>
- </keyset>
-
- <menupopup id="menu_ToolsPopup">
- <menuitem key="open-mozmill" id="mozmill-mozmill" label="&mozmill;"
- oncommand="MozMill.onMenuItemCommand(event);"/>
- </menupopup>
-</overlay>
deleted file mode 100644
--- a/mail/test/resources/mozmill/mozmill/extension/content/overlay_tb.xul
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0"?>
-<?xml-stylesheet href="chrome://mozmill/skin/overlay.css" type="text/css"?>
-<!DOCTYPE overlay SYSTEM "chrome://mozmill/locale/overlay.dtd">
-<overlay id="mozmill-overlay"
- xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
- <script src="overlay.js"/>
-
- <menupopup id="taskPopup">
- <menuitem id="mozmill-mozmill" label="&mozmill;"
- oncommand="MozMill.onMenuItemCommand(event);"/>
- </menupopup>
-</overlay>
deleted file mode 100644
--- a/mail/test/resources/mozmill/mozmill/extension/content/prefs.xul
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0"?>
-<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
-
-<prefwindow id="mozmill-prefs"
- title="MozMill Preferences"
- xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
-
-<prefpane id="mozpref" label="MozMill Preferences">
- <preferences>
- <preference id="pref1" name="stockwatcher2.symbol" type="string"/>
- </preferences>
-
- <hbox align="center">
- <label control="symbol" value="All kinds of preferences go in here."/>
- </hbox>
-</prefpane>
-
-</prefwindow>
\ No newline at end of file
deleted file mode 100644
--- a/mail/test/resources/mozmill/mozmill/extension/content/rec.js
+++ /dev/null
@@ -1,326 +0,0 @@
-// ***** BEGIN LICENSE BLOCK *****
-// Version: MPL 1.1/GPL 2.0/LGPL 2.1
-//
-// The contents of this file are subject to the Mozilla Public License Version
-// 1.1 (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-// http://www.mozilla.org/MPL/
-//
-// Software distributed under the License is distributed on an "AS IS" basis,
-// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-// for the specific language governing rights and limitations under the
-// License.
-//
-// The Original Code is Mozilla Corporation Code.
-//
-// The Initial Developer of the Original Code is
-// Adam Christian.
-// Portions created by the Initial Developer are Copyright (C) 2008
-// the Initial Developer. All Rights Reserved.
-//
-// Contributor(s):
-// Adam Christian <adam.christian@gmail.com>
-// Mikeal Rogers <mikeal.rogers@gmail.com>
-//
-// Alternatively, the contents of this file may be used under the terms of
-// either the GNU General Public License Version 2 or later (the "GPL"), or
-// the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-// in which case the provisions of the GPL or the LGPL are applicable instead
-// of those above. If you wish to allow use of your version of this file only
-// under the terms of either the GPL or the LGPL, and not to allow others to
-// use your version of this file under the terms of the MPL, indicate your
-// decision by deleting the provisions above and replace them with the notice
-// and other provisions required by the GPL or the LGPL. If you do not delete
-// the provisions above, a recipient may use your version of this file under
-// the terms of any one of the MPL, the GPL or the LGPL.
-//
-// ***** END LICENSE BLOCK *****
-
-var inspection = {}; Components.utils.import('resource://mozmill/modules/inspection.js', inspection);
-var utils = {}; Components.utils.import('resource://mozmill/modules/utils.js', utils);
-var objects = {}; Components.utils.import('resource://mozmill/stdlib/objects.js', objects);
-var arrays = {}; Components.utils.import('resource://mozmill/stdlib/arrays.js', arrays);
-var events = {}; Components.utils.import('resource://mozmill/modules/events.js', events);
-// var logging = {}; Components.utils.import('resource://mozmill/stdlib/logging.js', logging);
-var controller = {}; Components.utils.import('resource://mozmill/modules/controller.js', controller);
-
-// var recorderLogger = logging.getLogger('recorderLogger');
-
-var currentRecorderArray = [];
-
-var getEventSet = function (eArray) {
- var inSet = function (a, c) {
- for each(x in a) {
- if (x.evt.timeStamp == c.evt.timeStamp && c.evt.type == x.evt.type) {
- return true;
- }
- }
- return false;
- }
-
- var returnArray = [];
- for each(e in eArray) {
- // recorderLogger.info('ts '+e.evt.timeStamp+' '+inSet(returnArray, e))
- if (!inSet(returnArray, e)) {
- returnArray.push(e);
- }
- }
- return returnArray;
-}
-
-var recorderMethodCases = {
- 'click': function (x) {return 'click('+x['inspected'].elementText+')';},
- //this code is causing issues when recording type
- //and also requires the same code as the DX for genating accurate keypress
- //based on the new VK_ keyCode API
-
- 'keypress': function (x) {
- if (x['evt'].charCode == 0){
- return 'keypress(' + x['inspected'].elementText + ',' + x['evt'].keyCode + ', {ctrlKey:' +x['evt'].ctrlKey
- + ', altKey:'+ x['evt'].altKey + ',shiftKey:' + x['evt'].shiftKey + ', metaKey:' + x['evt'].metaKey + '})';
- }
- else {
- return 'keypress(' + x['inspected'].elementText + ',"' + String.fromCharCode(x['evt'].charCode) + '", {ctrlKey:' +x['evt'].ctrlKey
- + ', altKey:'+ x['evt'].altKey + ',shiftKey:' + x['evt'].shiftKey + ', metaKey:' + x['evt'].metaKey + '})';
- }
- },
- 'change': function (x) {return 'type('+x['inspected'].elementText+',"'+x['evt'].target.value+'")';},
- 'dblclick': function (x) { return 'doubleClick('+x['inspected'].elementText+')';},
-}
-
-var cleanupEventsArray = function (recorder_array) {
- var indexesForRemoval = [];
- var type_indexes = [x['evt'].type for each(x in recorder_array)];
-
- // Convert a set of keypress events to a single type event
- if (arrays.inArray(type_indexes, 'change')) {
- var offset = 0;
- while (arrays.indexOf(type_indexes, 'change', offset) != -1) {
- var eIndex = arrays.indexOf(type_indexes, 'change', offset);
- var e = recorder_array[eIndex];
- if (e['evt'].target.value != undefined && arrays.compare(e['evt'].target.value,
- [String.fromCharCode(x['evt'].charCode) for
- each(x in recorder_array.slice(eIndex - (e['evt'].target.value.length + 1) ,eIndex - 1))
- ])) {
- var i = eIndex - (e['evt'].target.value.length + 1)
- while (i < eIndex) {
- indexesForRemoval.push(i); i++;
- }
- } else if (e['evt'].target.value != undefined && arrays.compare(e['evt'].target.value,
- [String.fromCharCode(x['evt'].charCode) for
- each(x in recorder_array.slice(eIndex - (e['evt'].target.value.length) ,eIndex - 1))
- ])) {
- var i = eIndex - (e['evt'].target.value.length )
- while (i < eIndex) {
- indexesForRemoval.push(i); i++;
- }
- }
- var offset = arrays.indexOf(type_indexes, 'change', offset) + 1;
- }
- }
-
- // Remove change events with '' as value
- for (i in recorder_array) {
- var x = recorder_array[i];
- if (x['evt'].type == "change") {
- if (x['evt'].target.value == '') {
- indexesForRemoval.push(i);
- }
- }
- }
-
- // Cleanup trailing cmd+~
- try {
- var i = 1;
- while (recorder_array[recorder_array.length - i]['inspected'].controllerText == 'new mozmill.controller.MozMillController(mozmill.utils.getWindowByTitle("MozMill IDE"))') {
- i++;
- if (recorder_array[recorder_array.length - i]['evt'].charCode == 96) {
- indexesForRemoval.push(recorder_array.length - i);
- }
- }
- } catch(err){}
-
- // Remove any actions in the mozmill window
- for (i in recorder_array) {
- var inspected = recorder_array[i]['inspected'];
- if (inspected.controllerText == 'new mozmill.controller.MozMillController(mozmill.utils.getWindowByTitle("MozMill IDE"))') {
- indexesForRemoval.push(i);
- }
- }
-
- var narray = [];
- for (i in recorder_array) {
- if (!arrays.inArray(indexesForRemoval, i)) {
- narray.push(recorder_array[i]);
- }
- }
-
- return narray;
-}
-
-var getRecordedScript = function (recorder_array) {
- var setup = {};
- var test = [];
-
- var recorder_array = cleanupEventsArray(getEventSet(recorder_array));
-
- for each(x in recorder_array) {
- var inspected = x['inspected'];
- if (!setup[inspected.controllerText]) {
- if (objects.getLength(setup) > 0) {
- var ext = String(objects.getLength(setup) + 1);
- } else {
- var ext = '';
- }
- setup[inspected.controllerText] = 'controller'+ext
- }
- if (recorderMethodCases[x['evt'].type] == undefined) {
- alert("Don't have a case for event type: "+x['evt'].type)
- }
- var methodString = recorderMethodCases[x['evt'].type](x).replace(inspected.documentString, inspected.documentString.replace('controller.', setup[inspected.controllerText]+'.'))
-
- if (x['evt'].button == 2){
- methodString = methodString.replace("click", "rightClick");
- }
- test.push(setup[inspected.controllerText] + '.' + methodString + ';');
- }
-
- var rscript = ['var setupModule = function(module) {',];
- for (i in setup) {
- rscript.push(" "+setup[i]+' = '+i+';')
- }
- rscript.push('}')
- rscript.push('')
- rscript.push('var testRecorded = function () {')
- for each(t in test){
- rscript.push(' '+t);
- }
- rscript.push('}')
- return rscript.join('\n');
-}
-
-var RecorderConnector = function() {
- this.lastEvent = null;
- this.ison = false;
-}
-
-RecorderConnector.prototype.toggle = function(){
- if (this.ison)
- this.off();
- else
- this.on();
-};
-
-RecorderConnector.prototype.dispatch = function(evt){
- currentRecorderArray.push({'evt':evt, 'inspected':inspection.inspectElement(evt)});
- var value = editor.getContent();
- value += (evt.type + ':: ' + evt.timeStamp + '\n');
- editor.setContent(value);
-}
-
-//Recursively bind to all the iframes and frames within
-RecorderConnector.prototype.bindListeners = function(frame) {
- frame.addEventListener('click', this.dispatch, false);
- frame.addEventListener('dblclick', this.dispatch, false);
- frame.addEventListener('change', this.dispatch, false);
- frame.addEventListener('keypress', this.dispatch, false);
-
- var iframeCount = frame.window.frames.length;
- var iframeArray = frame.window.frames;
-
- for (var i = 0; i < iframeCount; i++)
- this.bindListeners(iframeArray[i]);
-}
-
-//Recursively bind to all the iframes and frames within
-RecorderConnector.prototype.unbindListeners = function(frame) {
- try {
- frame.removeEventListener('click', this.dispatch, false);
- frame.removeEventListener('dblclick', this.dispatch, false);
- frame.removeEventListener('change', this.dispatch, false);
- frame.removeEventListener('keypress', this.dispatch, false);
- }
- catch(error) {}
-
- var iframeCount = frame.window.frames.length;
- var iframeArray = frame.window.frames;
-
- for (var i = 0; i < iframeCount; i++)
- this.unbindListeners(iframeArray[i]);
-}
-
-//When a new win dom window gets opened
-RecorderConnector.prototype.observer = {
- observe: function(subject,topic,data){
- var defer = function(){
- controller.waitForEval("subject.mozmillDocumentLoaded == true", 10000, 100, subject)
- MozMillrec.bindListeners(subject);
- }
- window.setTimeout(defer, 500);
- }
-};
-
-RecorderConnector.prototype.on = function() {
- this.ison = true;
-
- // update UI
- $("#recordToggle").text("Stop Recording");
- $("#recordToggle").addClass("ui-state-highlight");
- $("#recordToggle").addClass("ui-priority-primary");
-
- newFile();
-
- for each(win in utils.getWindows()) {
- if (win.document.title != "MozMill IDE"){
- this.bindListeners(win);
- }
- }
-
- var mmWindows = utils.getWindows('navigator:browser');
- if (mmWindows.length != 0){
- mmWindows[0].focus();
- }
-
- var observerService =
- Components.classes["@mozilla.org/observer-service;1"]
- .getService(Components.interfaces.nsIObserverService);
-
- //Attach the new window open listener
- observerService.addObserver(this.observer, "toplevel-window-ready", false);
-
- currentRecorderArray = [];
-};
-
-RecorderConnector.prototype.off = function() {
- this.ison = false;
-
- //update UI
- $("#recordToggle").text("Record");
- $("#recordToggle").removeClass("ui-state-highlight");
- $("#recordToggle").removeClass("ui-priority-primary");
-
-
- for each(win in utils.getWindows()) {
- this.unbindListeners(win);
- }
- var r = getRecordedScript(currentRecorderArray);
-
- editor.setContent(r);
- currentRecorderArray = [];
- //remove new window listener
- var observerService =
- Components.classes["@mozilla.org/observer-service;1"]
- .getService(Components.interfaces.nsIObserverService);
- try { observerService.removeObserver(this.observer, "toplevel-window-ready"); }
- catch(err){}
-};
-
-var MozMillrec = new RecorderConnector();
-
-// Scoping bug workarounds
-var enableRec = function () {
- MozMillrec.on();
-}
-var disableRec = function () {
- MozMillrec.off();
-}
deleted file mode 100644
--- a/mail/test/resources/mozmill/mozmill/extension/content/shell.js
+++ /dev/null
@@ -1,226 +0,0 @@
-var controller = {}; Components.utils.import('resource://mozmill/modules/controller.js', controller);
-var events = {}; Components.utils.import('resource://mozmill/modules/events.js', events);
-var utils = {}; Components.utils.import('resource://mozmill/modules/utils.js', utils);
-var elementslib = {}; Components.utils.import('resource://mozmill/modules/elementslib.js', elementslib);
-var frame = {}; Components.utils.import('resource://mozmill/modules/frame.js', frame);
-
-var that = this;
-
-var hwindow = Components.classes["@mozilla.org/appshell/appShellService;1"]
- .getService(Components.interfaces.nsIAppShellService)
- .hiddenDOMWindow;
-
-var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
- .getService(Components.interfaces.nsIWindowMediator);
-
-var dir = function(obj){
- for (prop in obj){
- shell.send(prop);
- }
-}
-
-var shell = new function(){
- this.hist = [];
- this.histPos = 0;
- this.histLength = 20;
-
- //generate a new output entry node
- this.entry = function(val){
- var nd = document.createElement('div');
- nd.style.textAlign = "left";
- nd.style.paddingLeft = "5px";
- nd.style.paddingBottom = "1px";
- nd.style.font = "12px arial";
- nd.innerHTML = val;
- nd.style.display = "block";
- nd.style.width = "99%";
-
- return nd;
- }
- //generate a new output entry node
- this.cmdEntry = function(val){
- nd = shell.entry(val);
- nd.style.fontWeight = "bold";
- return nd;
- };
-
- this.sin = function(){
- return document.getElementById('shellInput');
- };
-
- this.sout = function(){
- return document.getElementById('shellOutput');
- };
-
- this.sendCmd = function(s){
- shell.sout().insertBefore(shell.cmdEntry('<font color="blue">mmsh%</font> <font color="tan">'+s+'</font>'), shell.sout().childNodes[0]);
- };
-
- //send output to console
- this.send = function(s){
- if (s == undefined){
- return;
- }
- shell.sout().insertBefore(shell.entry(s), shell.sout().childNodes[0]);
- };
-
- this.getWindows = function(){
- var enumerator = Components.classes["@mozilla.org/appshell/window-mediator;1"]
- .getService(Components.interfaces.nsIWindowMediator)
- .getEnumerator("");
- var s = "";
- //define an array we can access
- shell.windows = [];
- windows = shell.windows;
- var c = 1;
- while(enumerator.hasMoreElements()) {
- var win = enumerator.getNext();
- shell.windows.push(win);
- c++;
- }
- }
-
- this.handle = function(cmd){
- //if the command has spaces -- args
- var cmdArr = cmd.split(' ');
-
- switch(cmdArr[0]){
- //clear window
- case 'clear':
- shell.sout().innerHTML = "";
- break;
-
- case 'windows':
- shell.getWindows();
- for (win in shell.windows){
- shell.send( win+'. '+shell.windows[win].document.documentElement.getAttribute('windowtype') + ': ' + shell.windows[win].title);
- }
- shell.sendCmd(cmd);
- break;
-
- case 'dir':
- //if has an arg
- if (cmdArr[1]){
- try {
- var arg = eval(cmdArr[1]);
- for (prop in arg){
- shell.send(prop);
- }
- } catch(err){
- shell.send('Error: '+err);
- }
- }
- else {
- for (prop in that){
- shell.send(prop);
- }
- }
- shell.sendCmd(cmd);
- break;
- case 'help':
- var opts = [];
- opts.push('dir -- default shows you the current scope, \'dir obj\' or \'dir(obj)\' will show you the properties of the object.');
- opts.push('window -- reference to current content window.');
- opts.push('windows -- show you all the open in the browser.');
- opts.push('windows[x] -- access the window object of your choice');
- opts.push('elementslib -- bag of fun tricks for doing element lookups in the browser.');
- opts.push('hwindow -- ...');
- opts.push('controller -- ...');
- opts.push('events -- ...');
- opts.push('utils -- ...');
- opts.push('clear -- reset the output.');
-
- while(opts.length != 0){
- this.send(opts.pop());
- }
- this.sendCmd(cmd);
- break;
- //defaut is to eval
- default:
- try {
- var res = eval.call(that,cmd);
- if ((cmd.indexOf('=') == -1) && (res == null)){
- shell.send(cmd + ' is null.')
- }
- else {
- shell.send(res);
- }
- }
- catch(err){
- shell.send('<font color="red">Error:'+err+"</font>");
- }
- shell.sendCmd(cmd);
- }
-
- shell.sin().value = "";
- shell.sin().focus();
- };
-
- this.omc = function(event){
- if (event.target.value == "Type commands here..."){
- event.target.value = "";
- }
- };
-
- this.init = function(){
- document.getElementById('shellInput').addEventListener("keypress", shell.okp, false);
- document.getElementById('shellInput').addEventListener("mousedown", shell.omc, false);
-
- document.getElementById('shellInput').addEventListener("keydown", function(event){
- if (event.target.value == "Type commands here..."){
- event.target.value = "";
- }
- //if there is a command history
- if (shell.hist.length != 0){
- //uparrow
- if ((event.keyCode == 38) && (event.charCode == 0) && (event.shiftKey == true)){
- if (shell.histPos == shell.hist.length -1){
- shell.histPos = 0;
- } else {
- shell.histPos++;
- }
- shell.sin().value = shell.hist[shell.histPos];
- }
- //downarrow
- if ((event.keyCode == 40) && (event.charCode == 0) && (event.shiftKey == true)){
- if (shell.histPos == 0){
- shell.histPos = shell.hist.length -1;
- } else {
- shell.histPos--;
- }
- shell.sin().value = shell.hist[shell.histPos];
- }
- }
- }, false);
-
- };
-
- this.enter = function(event){
- var inp = document.getElementById('shellInput');
- //inp.value = strings.trim(inp.value);
- //ignore empty returns
- // if ((inp.value == "") || (inp.value == " ")){
- // return;
- // }
- //if we have less than histLength
- //if (shell.hist.length < shell.histLength){
- shell.hist.unshift(inp.value);
- shell.histPos = shell.hist.length -1;
- // }
- // else {
- // shell.hist.pop();
- // shell.hist.unshift(inp.value);
- // }
- //pass input commands to the handler
- shell.handle(inp.value);
- };
-
- this.okp = function(event){
- if ((event.keyCode == 13) && (event.shiftKey == false)){
- event.preventDefault();
- shell.enter(event);
- }
- };
-};
-
-shell.init();
deleted file mode 100644
--- a/mail/test/resources/mozmill/mozmill/extension/content/shortcuts.js
+++ /dev/null
@@ -1,93 +0,0 @@
-//Determines of the event is accel, meaning
-//ctrl or cmd depending on your platform
-//but none of the other modified keys
-function isAccel(e){
- var plat = navigator.platform;
- var isMac = (plat.indexOf('Mac') != -1);
- var modifiers = e.altKey;
-
- if ((isMac) && (!modifiers) && (e.metaKey) && (!e.ctrlKey) && (!e.shiftKey))
- return true;
- else if ((!isMac) && (!modifiers) && (e.ctrlKey) && (e.shiftKey) && (!e.metaKey))
- return true;
- return false;
-};
-
-//window onkeypress handler for various keyboard
-//shortcuts
-function onkeypress(e){
- if (isAccel(e)){
- switch(String.fromCharCode(e.charCode).toLowerCase()){
- case 'a':
- showFileMenu();
- e.preventDefault();
- break;
- case 'g':
- e.preventDefault();
- align();
- break;
- case 'o':
- e.preventDefault();
- openFile();
- break;
- case 'b':
- e.preventDefault();
- newFile();
- break;
- case 'r':
- e.preventDefault();
- runEditor();
- break;
- case 'd':
- e.preventDefault();
- MozMillrec.toggle();
- break;
- case 'e':
- e.preventDefault();
- saveAsFile();
- break;
- case 's':
- e.preventDefault();
- saveFile();
- break;
- case 'u':
- e.preventDefault();
- closeFile();
- break;
- case 'n':
- e.preventDefault();
- newTemplate();
- break;
- case 't':
- e.preventDefault();
- runDirectory();
- break;
- case 'h':
- e.preventDefault();
- openHelp();
- break;
- case 'l':
- e.preventDefault();
- logicalClear();
- break;
- case '1':
- e.preventDefault();
- $("#tabs").tabs().tabs("select", 0);
- break;
- case '2':
- e.preventDefault();
- $("#tabs").tabs().tabs("select", 1);
- break;
- case '3':
- e.preventDefault();
- $("#tabs").tabs().tabs("select", 2);
- break;
- case '4':
- e.preventDefault();
- $("#tabs").tabs().tabs("select", 3);
- break;
- default:
- return;
- }
- }
-};
deleted file mode 100644
--- a/mail/test/resources/mozmill/mozmill/extension/content/test/test.css
+++ /dev/null
@@ -1,13 +0,0 @@
-#item1 {
- margin: 60px;
- width: 40px;
- height: 40px;
- background-color: #CC7790;
-}
-
-#item2 {
- margin: 20px;
- max-width: 300px;
- height: 300px;
- background-color: #88AAE2;
-}
\ No newline at end of file
deleted file mode 100644
--- a/mail/test/resources/mozmill/mozmill/extension/content/test/test.html
+++ /dev/null
@@ -1,20 +0,0 @@
-<html>
-<head>
- <script src="test.js"></script>
- <link rel="stylesheet" href="test.css"/>
-</head>
-<body>
- <div id="testCollection">
- <div id="item1"
- ondragstart="dragStart(event)"
- draggable="true">
- </div>
-
- <div id="item2"
- ondrop="drop(event)"
- ondragenter="dragEnter(event)"
- ondragover="dragOver(event)">
- </div>
- </div>
-</body>
-</html>
\ No newline at end of file
deleted file mode 100644
--- a/mail/test/resources/mozmill/mozmill/extension/content/test/test.js
+++ /dev/null
@@ -1,16 +0,0 @@
-function drop(event) {
- var item = document.getElementById("item1");
- item.parentNode.removeChild(item);
-}
-
-function dragStart(event) {
- event.dataTransfer.setData("text/test-type", "test data");
-}
-
-function dragOver(event) {
- event.preventDefault();
-}
-
-function dragEnter(event) {
- event.preventDefault();
-}
\ No newline at end of file
deleted file mode 100644
--- a/mail/test/resources/mozmill/mozmill/extension/content/test/test.xul
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0"?>
-
-<?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?>
-<?xml-stylesheet href="test.css" type="text/css"?>
-
-<window id="testingonly"
- xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
- title="Testing And Debugging Window">
-
- <script src="test.js"/>
-
- <vbox id="testCollection">
- <hbox id="item1"
- ondragstart="dragStart(event)">
- </hbox>
-
- <hbox id="item2"
- ondrop="drop(event)"
- ondragover="return false">
- </hbox>
- </vbox>
-</window>
\ No newline at end of file
deleted file mode 100644
--- a/mail/test/resources/mozmill/mozmill/extension/content/testwindow.xul
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0"?>
-<?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?>
-
-<window id="testingonly"
- xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
- title="Testing And Debugging Window">
-
- <!-- Test Scripts -->
- <script src="js/mozmill.js"/>
- <script type="application/x-javascript;version=1.7" src="js/mm/testresults.js"/>
- <script src="js/tests/test_resultsFactory.js"/>
-
- <vbox id="testCollection" flex="1">
-
- <!-- Add more hboxes with items to test -->
- <hbox id="testItem1">
- <button id="testResultFactory"
- label="Test Result Factory and Result Object"
- oncommand="runResultFactoryTests();"/>
- <label id="testResultFactory-Status" value="Results" disabled="true"/>
- </hbox>
- <hbox id="testItem2">
- <button id="testObserver"
- label = "test observers"
- oncommand="goObservers();"/>
- <label id="testObserver" value="Results" disabled="true"/>
- </hbox>
- </vbox>
-</window>
deleted file mode 100644
--- a/mail/test/resources/mozmill/mozmill/extension/content/ui.js
+++ /dev/null
@@ -1,99 +0,0 @@
-var utils = {}; Components.utils.import('resource://mozmill/modules/utils.js', utils);
-
-var copyInspector = function() {
- MozMilldx.inspectorToClipboard();
- $("#tabs").tabs().tabs("select", 0);
-}
-
-function showFileMenu() {
- $("#fileMenu").click();
-}
-
-function openNewWindow() {
- window.open('');
-}
-
-function testFinished(){
- $("#tabs").tabs().tabs("select", 1);
- window.focus();
-}
-
-function swapTabs(tab){
- $('editorTab').style.display = 'none';
- $('outputTab').style.display = 'none';
- $('eventsTab').style.display = 'none';
- $('shellTab').style.display = 'none';
-
- $('editorHead').style.background = '#aaa';
- $('outputHead').style.background = '#aaa';
- $('eventsHead').style.background = '#aaa';
- $('shellHead').style.background = '#aaa';
-
- $(tab+'Tab').style.display = 'block';
- $(tab+'Head').style.background = 'white';
-}
-
-function logicalClear(){
- $('#resOut')[0].innerHTML = '';
-}
-
-function accessOutput(){
- var n = $('resOut');
- var txt = '';
- for (var c = 0; c < n.childNodes.length; c++){
- if (n.childNodes[c].textContent){
- txt += n.childNodes[c].textContent + '\n';
- }
- else{
- txt += n.childNodes[c].value + '\n';
- }
- }
- if (txt == undefined){ return; }
- copyToClipboard(txt);
-}
-
-var copyToClipboard = function(str){
- const gClipboardHelper = Components.classes["@mozilla.org/widget/clipboardhelper;1"] .getService(Components.interfaces.nsIClipboardHelper);
- gClipboardHelper.copyString(str);
-}
-
-var showFileDialog = function(){
- $("#fileDialog").dialog("open");
-}
-
-//Align mozmill to all the other open windows in a way that makes it usable
-var align = function(){
- var enumerator = Components.classes["@mozilla.org/appshell/window-mediator;1"]
- .getService(Components.interfaces.nsIWindowMediator)
- .getEnumerator("");
- while(enumerator.hasMoreElements()) {
- var win = enumerator.getNext();
- if (win.document.title != 'MozMill IDE'){
- var wintype = win.document.documentElement.getAttribute("windowtype");
- //move to top left corner
- win.screenY = 0;
- win.screenX = 0;
-
- //make only browser windows big
- if (wintype == "navigator:browser"){
- var width = window.screen.availWidth/2.5;
- var height = window.screen.availHeight;
- win.resizeTo((window.screen.availWidth - width), window.screen.availHeight);
- }
- }
- else {
- var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
- .getService(Components.interfaces.nsIWindowMediator);
- var latestbrowser = wm.getMostRecentWindow('navigator:browser');
-
- //if there is no most recent browser window, use whatever window
- if (!latestbrowser){
- var latestbrowser = wm.getMostRecentWindow('');
- }
-
- win.screenX = latestbrowser.innerWidth;
- win.screenY = 0;
- }
- }
- return true;
-};
deleted file mode 100644
--- a/mail/test/resources/mozmill/mozmill/extension/defaults/preferences/debug.js
+++ /dev/null
@@ -1,3 +0,0 @@
-/* debugging prefs */
-pref("browser.dom.window.dump.enabled", true);
-pref("javascript.options.showInConsole", true);
deleted file mode 100644
--- a/mail/test/resources/mozmill/mozmill/extension/install.rdf
+++ /dev/null
@@ -1,59 +0,0 @@
-<?xml version="1.0"?>
-<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- xmlns:em="http://www.mozilla.org/2004/em-rdf#">
- <Description about="urn:mozilla:install-manifest">
- <em:id>mozmill@mozilla.com</em:id>
- <em:name>MozMill</em:name>
- <em:version>1.5.4b4</em:version>
- <em:creator>Adam Christian</em:creator>
- <em:description>A testing extension based on the Windmill Testing Framework client source</em:description>
- <em:unpack>true</em:unpack>
- <em:targetApplication>
- <!-- Firefox -->
- <Description>
- <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
- <em:minVersion>3.5</em:minVersion>
- <em:maxVersion>7.*</em:maxVersion>
- </Description>
- </em:targetApplication>
- <em:targetApplication>
- <!-- Thunderbird -->
- <Description>
- <em:id>{3550f703-e582-4d05-9a08-453d09bdfdc6}</em:id>
- <em:minVersion>3.0a1pre</em:minVersion>
- <em:maxVersion>6.*</em:maxVersion>
- </Description>
- </em:targetApplication>
- <em:targetApplication>
- <!-- Sunbird -->
- <Description>
- <em:id>{718e30fb-e89b-41dd-9da7-e25a45638b28}</em:id>
- <em:minVersion>0.6a1</em:minVersion>
- <em:maxVersion>1.0pre</em:maxVersion>
- </Description>
- </em:targetApplication>
- <em:targetApplication>
- <!-- SeaMonkey -->
- <Description>
- <em:id>{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}</em:id>
- <em:minVersion>2.0a1</em:minVersion>
- <em:maxVersion>3.*</em:maxVersion>
- </Description>
- </em:targetApplication>
- <em:targetApplication>
- <!-- Songbird -->
- <Description>
- <em:id>songbird@songbirdnest.com</em:id>
- <em:minVersion>0.3pre</em:minVersion>
- <em:maxVersion>2.*</em:maxVersion>
- </Description>
- </em:targetApplication>
- <em:targetApplication>
- <Description>
- <em:id>toolkit@mozilla.org</em:id>
- <em:minVersion>1.9.1</em:minVersion>
- <em:maxVersion>2.*</em:maxVersion>
- </Description>
- </em:targetApplication>
- </Description>
-</RDF>
deleted file mode 100644
--- a/mail/test/resources/mozmill/mozmill/extension/locale/en-US/mozmill.dtd
+++ /dev/null
@@ -1,3 +0,0 @@
-<!ENTITY title.label "MozMill IDE">
-<!ENTITY separate.label "This is a separate window!">
-<!ENTITY close.label "Close">
\ No newline at end of file
deleted file mode 100644
--- a/mail/test/resources/mozmill/mozmill/extension/locale/en-US/overlay.dtd
+++ /dev/null
@@ -1,1 +0,0 @@
-<!ENTITY mozmill "MozMill">
\ No newline at end of file
deleted file mode 100644
--- a/mail/test/resources/mozmill/mozmill/extension/readme.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-MozMill Firefox Extension
-
-All kinds of great info goes here...
\ No newline at end of file
deleted file mode 100644
--- a/mail/test/resources/mozmill/mozmill/extension/resource/modules/controller.js
+++ /dev/null
@@ -1,1337 +0,0 @@
-// ***** BEGIN LICENSE BLOCK *****
-// Version: MPL 1.1/GPL 2.0/LGPL 2.1
-//
-// The contents of this file are subject to the Mozilla Public License Version
-// 1.1 (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-// http://www.mozilla.org/MPL/
-//
-// Software distributed under the License is distributed on an "AS IS" basis,
-// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-// for the specific language governing rights and limitations under the
-// License.
-//
-// The Original Code is Mozilla Corporation Code.
-//
-// The Initial Developer of the Original Code is
-// Adam Christian.
-// Portions created by the Initial Developer are Copyright (C) 2008
-// the Initial Developer. All Rights Reserved.
-//
-// Contributor(s):
-// Adam Christian <adam.christian@gmail.com>
-// Mikeal Rogers <mikeal.rogers@gmail.com>
-// Henrik Skupin <hskupin@mozilla.com>
-// Aaron Train <atrain@mozilla.com>
-//
-// Alternatively, the contents of this file may be used under the terms of
-// either the GNU General Public License Version 2 or later (the "GPL"), or
-// the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-// in which case the provisions of the GPL or the LGPL are applicable instead
-// of those above. If you wish to allow use of your version of this file only
-// under the terms of either the GPL or the LGPL, and not to allow others to
-// use your version of this file under the terms of the MPL, indicate your
-// decision by deleting the provisions above and replace them with the notice
-// and other provisions required by the GPL or the LGPL. If you do not delete
-// the provisions above, a recipient may use your version of this file under
-// the terms of any one of the MPL, the GPL or the LGPL.
-//
-// ***** END LICENSE BLOCK *****
-
-var EXPORTED_SYMBOLS = ["MozMillController", "waitForEval", "MozMillAsyncTest",
- "globalEventRegistry", "sleep"];
-
-var EventUtils = {}; Components.utils.import('resource://mozmill/stdlib/EventUtils.js', EventUtils);
-
-var events = {}; Components.utils.import('resource://mozmill/modules/events.js', events);
-var utils = {}; Components.utils.import('resource://mozmill/modules/utils.js', utils);
-var elementslib = {}; Components.utils.import('resource://mozmill/modules/elementslib.js', elementslib);
-var frame = {}; Components.utils.import('resource://mozmill/modules/frame.js', frame);
-
-var hwindow = Components.classes["@mozilla.org/appshell/appShellService;1"]
- .getService(Components.interfaces.nsIAppShellService)
- .hiddenDOMWindow;
-var aConsoleService = Components.classes["@mozilla.org/consoleservice;1"].
- getService(Components.interfaces.nsIConsoleService);
-
-// Declare most used utils functions in the controller namespace
-var sleep = utils.sleep;
-var assert = utils.assert;
-var waitFor = utils.waitFor;
-var waitForEval = utils.waitForEval;
-
-
-waitForEvents = function() {}
-
-waitForEvents.prototype = {
- /**
- * Initialize list of events for given node
- */
- init : function waitForEvents_init(node, events) {
- if (node.getNode != undefined)
- node = node.getNode();
-
- this.events = events;
- this.node = node;
- node.firedEvents = {};
- this.registry = {};
-
- for each(e in events) {
- var listener = function(event) {
- this.firedEvents[event.type] = true;
- }
- this.registry[e] = listener;
- this.registry[e].result = false;
- this.node.addEventListener(e, this.registry[e], true);
- }
- },
-
- /**
- * Wait until all assigned events have been fired
- */
- wait : function waitForEvents_wait(timeout, interval)
- {
- for (var e in this.registry) {
- utils.waitFor(function() {
- return this.node.firedEvents[e] == true;
- }, "Timeout happened before event '" + ex +"' was fired.", timeout, interval);
-
- this.node.removeEventListener(e, this.registry[e], true);
- }
- }
-}
-
-
-/**
- * Class to handle menus and context menus
- *
- * @constructor
- * @param {MozMillController} controller
- * Mozmill controller of the window under test
- * @param {string} menuSelector
- * jQuery like selector string of the element
- * @param {object} document
- * Document to use for finding the menu
- * [optional - default: aController.window.document]
- */
-var Menu = function(controller, menuSelector, document) {
- this._controller = controller;
- this._menu = null;
-
- document = document || controller.window.document;
- var node = document.querySelector(menuSelector);
- if (node) {
- // We don't unwrap nodes automatically yet (Bug 573185)
- node = node.wrappedJSObject || node;
- this._menu = new elementslib.Elem(node);
- }
- else {
- throw new Error("Menu element '" + menuSelector + "' not found.");
- }
-}
-
-Menu.prototype = {
-
- /**
- * Open and populate the menu
- *
- * @param {ElemBase} contextElement
- * Element whose context menu has to be opened
- * @returns {Menu} The Menu instance
- */
- open : function(contextElement) {
- // We have to open the context menu
- var menu = this._menu.getNode();
- if ((menu.localName == "popup" || menu.localName == "menupopup") &&
- contextElement && contextElement.exists()) {
- this._controller.rightClick(contextElement);
- this._controller.waitFor(function() {
- return menu.state == "open";
- }, "Context menu has been opened.");
- }
-
- // Run through the entire menu and populate with dynamic entries
- this._buildMenu(menu);
-
- return this;
- },
-
- /**
- * Close the menu
- *
- * @returns {Menu} The Menu instance
- */
- close : function() {
- var menu = this._menu.getNode();
-
- this._controller.keypress(this._menu, "VK_ESCAPE", {});
- this._controller.waitFor(function() {
- return menu.state == "closed";
- }, "Context menu has been closed.");
-
- return this;
- },
-
- /**
- * Retrieve the specified menu entry
- *
- * @param {string} itemSelector
- * jQuery like selector string of the menu item
- * @returns {ElemBase} Menu element
- * @throws Error If menu element has not been found
- */
- getItem : function(itemSelector) {
- var node = this._menu.getNode().querySelector(itemSelector);
-
- if (!node) {
- throw new Error("Menu entry '" + itemSelector + "' not found.");
- }
-
- return new elementslib.Elem(node);
- },
-
- /**
- * Click the specified menu entry
- *
- * @param {string} itemSelector
- * jQuery like selector string of the menu item
- *
- * @returns {Menu} The Menu instance
- */
- click : function(itemSelector) {
- this._controller.click(this.getItem(itemSelector));
-
- return this;
- },
-
- /**
- * Synthesize a keypress against the menu
- *
- * @param {string} key
- * Key to press
- * @param {object} modifier
- * Key modifiers
- * @see MozMillController#keypress
- *
- * @returns {Menu} The Menu instance
- */
- keypress : function(key, modifier) {
- this._controller.keypress(this._menu, key, modifier);
-
- return this;
- },
-
- /**
- * Opens the context menu, click the specified entry and
- * make sure that the menu has been closed.
- *
- * @param {string} itemSelector
- * jQuery like selector string of the element
- * @param {ElemBase} contextElement
- * Element whose context menu has to be opened
- *
- * @returns {Menu} The Menu instance
- */
- select : function(itemSelector, contextElement) {
- this.open(contextElement);
- this.click(itemSelector);
- this.close();
- },
-
- /**
- * Recursive function which iterates through all menu elements and
- * populates the menus with dynamic menu entries.
- *
- * @param {node} menu
- * Top menu node whose elements have to be populated
- */
- _buildMenu : function(menu) {
- var items = menu ? menu.childNodes : null;
-
- Array.forEach(items, function(item) {
- // When we have a menu node, fake a click onto it to populate
- // the sub menu with dynamic entries
- if (item.tagName == "menu") {
- var popup = item.querySelector("menupopup");
- if (popup) {
- if (popup.allowevents) {
- events.fakeOpenPopup(this._controller.window, popup);
- }
- this._buildMenu(popup);
- }
- }
- }, this);
- }
-};
-
-/**
- * Deprecated - Has to be removed with Mozmill 2.0
- */
-var MenuTree = function(aWindow, aMenu) {
- var items = aMenu ? aMenu.childNodes : null;
-
- for each (var node in items) {
- var entry = null;
-
- switch (node.tagName) {
- case "menu":
- // Fake a click onto the menu to add dynamic entries
- var popup = node.querySelector("menupopup");
- if (popup) {
- if (popup.allowevents) {
- events.fakeOpenPopup(aWindow, popup);
- }
- entry = new MenuTree(aWindow, popup);
- }
- break;
- case "menuitem":
- entry = node;
- break;
- default:
- continue;
- }
-
- if (entry) {
- var label = node.getAttribute("label");
- this[label] = entry;
-
- if (node.id)
- this[node.id] = this[label];
- }
- }
-};
-
-var MozMillController = function (window) {
- this.window = window;
-
- this.mozmillModule = {};
- Components.utils.import('resource://mozmill/modules/mozmill.js', this.mozmillModule);
-
- utils.waitFor(function() {
- return window != null && this.isLoaded();
- }, "controller(): Window could not be initialized.", undefined, undefined, this);
-
- if ( controllerAdditions[window.document.documentElement.getAttribute('windowtype')] != undefined ) {
- this.prototype = new utils.Copy(this.prototype);
- controllerAdditions[window.document.documentElement.getAttribute('windowtype')](this);
- this.windowtype = window.document.documentElement.getAttribute('windowtype');
- }
-}
-
-MozMillController.prototype.sleep = utils.sleep;
-
-/**
- * Synthesize a keypress event on the given element
- *
- * @param {ElemBase} aTarget
- * Element which will receive the keypress event
- * @param {string} aKey
- * Key to use for synthesizing the keypress event. It can be a simple
- * character like "k" or a string like "VK_ESCAPE" for command keys
- * @param {object} aModifiers
- * Information about the modifier keys to send
- * Elements: accelKey - Hold down the accelerator key (ctrl/meta)
- * [optional - default: false]
- * altKey - Hold down the alt key
- * [optional - default: false]
- * ctrlKey - Hold down the ctrl key
- * [optional - default: false]
- * metaKey - Hold down the meta key (command key on Mac)
- * [optional - default: false]
- * shiftKey - Hold down the shift key
- * [optional - default: false]
- * @param {object} aExpectedEvent
- * Information about the expected event to occur
- * Elements: target - Element which should receive the event
- * [optional - default: current element]
- * type - Type of the expected key event
- */
-MozMillController.prototype.keypress = function(aTarget, aKey, aModifiers, aExpectedEvent) {
- var element = (aTarget == null) ? this.window : aTarget.getNode();
- if (!element) {
- throw new Error("Could not find element " + aTarget.getInfo());
- return false;
- }
-
- events.triggerKeyEvent(element, 'keypress', aKey, aModifiers, aExpectedEvent);
-
- frame.events.pass({'function':'Controller.keypress()'});
- return true;
-}
-
-/**
- * Synthesize keypress events for each character on the given element
- *
- * @param {ElemBase} aTarget
- * Element which will receive the type event
- * @param {string} aText
- * The text to send as single keypress events
- * @param {object} aExpectedEvent
- * Information about the expected event to occur
- * Elements: target - Element which should receive the event
- * [optional - default: current element]
- * type - Type of the expected key event
- */
-MozMillController.prototype.type = function (aTarget, aText, aExpectedEvent) {
- var element = (aTarget == null) ? this.window : aTarget.getNode();
- if (!element) {
- throw new Error("could not find element " + aTarget.getInfo());
- return false;
- }
-
- Array.forEach(aText, function(letter) {
- events.triggerKeyEvent(element, 'keypress', letter, {}, aExpectedEvent);
- });
-
- frame.events.pass({'function':'Controller.type()'});
- return true;
-}
-
-// Open the specified url in the current tab
-MozMillController.prototype.open = function(url)
-{
- switch(this.mozmillModule.Application) {
- case "Firefox":
- this.window.gBrowser.loadURI(url);
- break;
- case "SeaMonkey":
- this.window.getBrowser().loadURI(url);
- break;
- default:
- throw new Error("MozMillController.open not supported.");
- }
-
- frame.events.pass({'function':'Controller.open()'});
-}
-
-/**
- * Synthesize a general mouse event on the given element
- *
- * @param {ElemBase} aTarget
- * Element which will receive the mouse event
- * @param {number} aOffsetX
- * Relative x offset in the elements bounds to click on
- * @param {number} aOffsetY
- * Relative y offset in the elements bounds to click on
- * @param {object} aEvent
- * Information about the event to send
- * Elements: accelKey - Hold down the accelerator key (ctrl/meta)
- * [optional - default: false]
- * altKey - Hold down the alt key
- * [optional - default: false]
- * button - Mouse button to use
- * [optional - default: 0]
- * clickCount - Number of counts to click
- * [optional - default: 1]
- * ctrlKey - Hold down the ctrl key
- * [optional - default: false]
- * metaKey - Hold down the meta key (command key on Mac)
- * [optional - default: false]
- * shiftKey - Hold down the shift key
- * [optional - default: false]
- * type - Type of the mouse event ('click', 'mousedown',
- * 'mouseup', 'mouseover', 'mouseout')
- * [optional - default: 'mousedown' + 'mouseup']
- * @param {object} aExpectedEvent
- * Information about the expected event to occur
- * Elements: target - Element which should receive the event
- * [optional - default: current element]
- * type - Type of the expected mouse event
- */
-MozMillController.prototype.mouseEvent = function(aTarget, aOffsetX, aOffsetY,
- aEvent, aExpectedEvent) {
-
- var element = aTarget.getNode();
- if (!element) {
- throw new Error(arguments.callee.name + ": could not find element " +
- aTarget.getInfo());
- }
-
- // If no offset is given we will use the center of the element to click on.
- var rect = element.getBoundingClientRect();
- if (isNaN(aOffsetX))
- aOffsetX = rect.width / 2;
- if (isNaN(aOffsetY))
- aOffsetY = rect.height / 2;
-
- // Scroll element into view otherwise the click will fail
- if (element.scrollIntoView)
- element.scrollIntoView();
-
- if (aExpectedEvent) {
- // The expected event type has to be set
- if (!aExpectedEvent.type)
- throw new Error(arguments.callee.name + ": Expected event type not specified");
-
- // If no target has been specified use the specified element
- var target = aExpectedEvent.target ? aExpectedEvent.target.getNode() : element;
- if (!target) {
- throw new Error(arguments.callee.name + ": could not find element " +
- aExpectedEvent.target.getInfo());
- }
-
- EventUtils.synthesizeMouseExpectEvent(element, aOffsetX, aOffsetY, aEvent,
- target, aExpectedEvent.event,
- "controller.mouseEvent()",
- element.ownerDocument.defaultView);
- } else {
- EventUtils.synthesizeMouse(element, aOffsetX, aOffsetY, aEvent,
- element.ownerDocument.defaultView);
- }
-
- sleep(0);
-}
-
-/**
- * Synthesize a mouse click event on the given element
- */
-MozMillController.prototype.click = function(elem, left, top, expectedEvent) {
- var element = elem.getNode()
-
- // Handle menu items differently
- if (element && element.tagName == "menuitem") {
- element.click();
- } else {
- this.mouseEvent(elem, left, top, {}, expectedEvent);
- }
-
- frame.events.pass({'function':'controller.click()'});
-}
-
-/**
- * Synthesize a double click on the given element
- */
-MozMillController.prototype.doubleClick = function(elem, left, top, expectedEvent) {
- this.mouseEvent(elem, left, top, {clickCount: 2}, expectedEvent);
-
- frame.events.pass({'function':'controller.doubleClick()'});
- return true;
-}
-
-/**
- * Synthesize a mouse down event on the given element
- */
-MozMillController.prototype.mouseDown = function (elem, button, left, top, expectedEvent) {
- this.mouseEvent(elem, left, top, {button: button, type: "mousedown"}, expectedEvent);
-
- frame.events.pass({'function':'controller.mouseDown()'});
- return true;
-};
-
-/**
- * Synthesize a mouse out event on the given element
- */
-MozMillController.prototype.mouseOut = function (elem, button, left, top, expectedEvent) {
- this.mouseEvent(elem, left, top, {button: button, type: "mouseout"}, expectedEvent);
-
- frame.events.pass({'function':'controller.mouseOut()'});
- return true;
-};
-
-/**
- * Synthesize a mouse over event on the given element
- */
-MozMillController.prototype.mouseOver = function (elem, button, left, top, expectedEvent) {
- this.mouseEvent(elem, left, top, {button: button, type: "mouseover"}, expectedEvent);
-
- frame.events.pass({'function':'controller.mouseOver()'});
- return true;
-};
-
-/**
- * Synthesize a mouse up event on the given element
- */
-MozMillController.prototype.mouseUp = function (elem, button, left, top, expectedEvent) {
- this.mouseEvent(elem, left, top, {button: button, type: "mouseup"}, expectedEvent);
-
- frame.events.pass({'function':'controller.mouseUp()'});
- return true;
-};
-
-/**
- * Synthesize a mouse middle click event on the given element
- */
-MozMillController.prototype.middleClick = function(elem, left, top, expectedEvent) {
- this.mouseEvent(elem, left, top, {button: 1}, expectedEvent);
-
- frame.events.pass({'function':'controller.middleClick()'});
- return true;
-}
-
-/**
- * Synthesize a mouse right click event on the given element
- */
-MozMillController.prototype.rightClick = function(elem, left, top, expectedEvent) {
- this.mouseEvent(elem, left, top, {type : "contextmenu", button: 2 }, expectedEvent);
-
- frame.events.pass({'function':'controller.rightClick()'});
- return true;
-}
-
-/**
- * Synthesize a mouse right click event on the given element (deprecated)
- */
-MozMillController.prototype.rightclick = function(){
- frame.log({function:'rightclick - Deprecation Warning', message:'Controller.rightclick should be renamed to Controller.rightClick'});
- this.rightClick.apply(this, arguments);
-}
-
-/**
- * Enable/Disable a checkbox depending on the target state
- */
-MozMillController.prototype.check = function(el, state) {
- var result = false;
- var element = el.getNode();
-
- if (!element) {
- throw new Error("could not find element " + el.getInfo());
- return false;
- }
-
- // If we have a XUL element, unwrap its XPCNativeWrapper
- if (element.namespaceURI == "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul") {
- element = utils.unwrapNode(element);
- }
-
- state = (typeof(state) == "boolean") ? state : false;
- if (state != element.checked) {
- this.click(el);
- this.waitFor(function() {
- return element.checked == state;
- }, "Checkbox " + el.getInfo() + " could not be checked/unchecked", 500);
-
- result = true;
- }
-
- frame.events.pass({'function':'Controller.check(' + el.getInfo() + ', state: ' + state + ')'});
- return result;
-}
-
-/**
- * Select the given radio button
- */
-MozMillController.prototype.radio = function(el)
-{
- var element = el.getNode();
- if (!element) {
- throw new Error("could not find element " + el.getInfo());
- return false;
- }
-
- this.click(el);
- this.waitFor(function() {
- // If we have a XUL element, unwrap its XPCNativeWrapper
- if (element.namespaceURI == "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul") {
- element = utils.unwrapNode(element);
- return element.selected == true;
- }
- return element.checked == true;
- }, "Radio button " + el.getInfo() + " could not be selected", 500);
-
- frame.events.pass({'function':'Controller.radio(' + el.getInfo() + ')'});
- return true;
-}
-
-/**
- * Checks if the specified window has been loaded
- *
- * @param {DOMWindow} [window=this.window] Window object to check for loaded state
- */
-MozMillController.prototype.isLoaded = function (window) {
- var win = window || this.window;
-
- return ("mozmillDocumentLoaded" in win) && win.mozmillDocumentLoaded;
-}
-
-MozMillController.prototype.waitFor = function(callback, message, timeout,
- interval, thisObject) {
- utils.waitFor(callback, message, timeout, interval, thisObject);
-
- frame.events.pass({'function':'controller.waitFor()'});
-}
-
-MozMillController.prototype.waitForEval = function(expression, timeout, interval, subject) {
- waitFor(function() {
- return eval(expression);
- }, "controller.waitForEval: Timeout exceeded for '" + expression + "'", timeout, interval);
-
- frame.events.pass({'function':'controller.waitForEval()'});
-}
-
-MozMillController.prototype.waitForElement = function(elem, timeout, interval) {
- this.waitFor(function() {
- return elem.exists();
- }, "Timeout exceeded for waitForElement " + elem.getInfo(), timeout, interval);
-
- frame.events.pass({'function':'Controller.waitForElement()'});
-}
-
-MozMillController.prototype.waitForElementNotPresent = function(elem, timeout, interval) {
- this.waitFor(function() {
- return !elem.exists();
- }, "Timeout exceeded for waitForElementNotPresent " + elem.getInfo(), timeout, interval);
-
- frame.events.pass({'function':'Controller.waitForElementNotPresent()'});
-}
-
-MozMillController.prototype.__defineGetter__("waitForEvents", function() {
- if (this._waitForEvents == undefined)
- this._waitForEvents = new waitForEvents();
- return this._waitForEvents;
-});
-
-/**
- * Wrapper function to create a new instance of a menu
- * @see Menu
- */
-MozMillController.prototype.getMenu = function (menuSelector, document) {
- return new Menu(this, menuSelector, document);
-};
-
-MozMillController.prototype.__defineGetter__("mainMenu", function() {
- return this.getMenu("menubar");
-});
-
-MozMillController.prototype.__defineGetter__("menus", function() {
- frame.log({'property': 'controller.menus - DEPRECATED',
- 'message': 'Use controller.mainMenu instead.'});
-
- var menubar = this.window.document.querySelector("menubar");
- return new MenuTree(this.window, menubar);
-});
-
-MozMillController.prototype.waitForImage = function (elem, timeout, interval) {
- this.waitFor(function() {
- return elem.getNode().complete == true;
- }, "timeout exceeded for waitForImage " + elem.getInfo(), timeout, interval);
-
- frame.events.pass({'function':'Controller.waitForImage()'});
-}
-
-MozMillController.prototype.waitThenClick = function (elem, timeout, interval) {
- this.waitForElement(elem, timeout, interval);
- this.click(elem);
-}
-
-MozMillController.prototype.fireEvent = function (name, obj) {
- if (name == "userShutdown") {
- frame.events.toggleUserShutdown();
- }
- frame.events.fireEvent(name, obj);
-}
-
-MozMillController.prototype.startUserShutdown = function (timeout, restart) {
- // 0 = default shutdown, 1 = user shutdown, 2 = user restart
- this.fireEvent('userShutdown', restart ? 2 : 1);
- this.window.setTimeout(this.fireEvent, timeout, 'userShutdown', 0);
-}
-
-/* Select the specified option and trigger the relevant events of the element.*/
-MozMillController.prototype.select = function (el, indx, option, value) {
- element = el.getNode();
- if (!element){
- throw new Error("Could not find element " + el.getInfo());
- return false;
- }
-
- //if we have a select drop down
- if (element.localName.toLowerCase() == "select"){
- var item = null;
-
- // The selected item should be set via its index
- if (indx != undefined) {
- // Resetting a menulist has to be handled separately
- if (indx == -1) {
- events.triggerEvent(element, 'focus', false);
- element.selectedIndex = indx;
- events.triggerEvent(element, 'change', true);
-
- frame.events.pass({'function':'Controller.select()'});
- return true;
- } else {
- item = element.options.item(indx);
- }
- } else {
- for (var i = 0; i < element.options.length; i++) {
- var entry = element.options.item(i);
- if (option != undefined && entry.innerHTML == option ||
- value != undefined && entry.value == value) {
- item = entry;
- break;
- }
- }
- }
-
- // Click the item
- try {
- // EventUtils.synthesizeMouse doesn't work.
- events.triggerEvent(element, 'focus', false);
- item.selected = true;
- events.triggerEvent(element, 'change', true);
-
- frame.events.pass({'function':'Controller.select()'});
- return true;
- } catch (ex) {
- throw new Error("No item selected for element " + el.getInfo());
- return false;
- }
- }
- //if we have a xul menulist select accordingly
- else if (element.localName.toLowerCase() == "menulist") {
- ownerDoc = element.ownerDocument;
- // Unwrap the XUL element's XPCNativeWrapper
- if (element.namespaceURI.toLowerCase() == "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul") {
- element = utils.unwrapNode(element);
- }
-
- var item = null;
-
- if (indx != undefined) {
- if (indx == -1) {
- events.triggerEvent(element, 'focus', false);
- element.selectedIndex = indx;
- events.triggerEvent(element, 'change', true);
-
- frame.events.pass({'function':'Controller.select()'});
- return true;
- } else {
- item = element.getItemAtIndex(indx);
- }
- } else {
- for (var i = 0; i < element.itemCount; i++) {
- var entry = element.getItemAtIndex(i);
- if (option != undefined && entry.label == option ||
- value != undefined && entry.value == value) {
- item = entry;
- break;
- }
- }
- }
-
- // Click the item
- try {
- EventUtils.synthesizeMouse(element, 1, 1, {}, ownerDoc.defaultView);
- this.sleep(0);
-
- // Scroll down until item is visible
- for (var i = s = element.selectedIndex; i <= element.itemCount + s; ++i) {
- var entry = element.getItemAtIndex((i + 1) % element.itemCount);
- EventUtils.synthesizeKey("VK_DOWN", {}, ownerDoc.defaultView);
- if (entry.label == item.label) {
- break;
- }
- else if (entry.label == "") i += 1;
- }
-
- EventUtils.synthesizeMouse(item, 1, 1, {}, ownerDoc.defaultView);
- this.sleep(0);
-
- frame.events.pass({'function':'Controller.select()'});
- return true;
- } catch (ex) {
- throw new Error('No item selected for element ' + el.getInfo());
- return false;
- }
- }
-};
-
-//Browser navigation functions
-MozMillController.prototype.goBack = function(){
- //this.window.focus();
- this.window.content.history.back();
- frame.events.pass({'function':'Controller.goBack()'});
- return true;
-}
-MozMillController.prototype.goForward = function(){
- //this.window.focus();
- this.window.content.history.forward();
- frame.events.pass({'function':'Controller.goForward()'});
- return true;
-}
-MozMillController.prototype.refresh = function(){
- //this.window.focus();
- this.window.content.location.reload(true);
- frame.events.pass({'function':'Controller.refresh()'});
- return true;
-}
-
-MozMillController.prototype.assertText = function (el, text) {
- //this.window.focus();
- var n = el.getNode();
-
- if (n && n.innerHTML == text){
- frame.events.pass({'function':'Controller.assertText()'});
- return true;
- }
-
- throw new Error("could not validate element " + el.getInfo()+" with text "+ text);
- return false;
-
-};
-
-//Assert that a specified node exists
-MozMillController.prototype.assertNode = function (el) {
- //this.window.focus();
- var element = el.getNode();
- if (!element){
- throw new Error("could not find element " + el.getInfo());
- return false;
- }
- frame.events.pass({'function':'Controller.assertNode()'});
- return true;
-};
-
-// Assert that a specified node doesn't exist
-MozMillController.prototype.assertNodeNotExist = function (el) {
- //this.window.focus();
- try {
- var element = el.getNode();
- } catch(err){
- frame.events.pass({'function':'Controller.assertNodeNotExist()'});
- return true;
- }
-
- if (element) {
- throw new Error("Unexpectedly found element " + el.getInfo());
- return false;
- } else {
- frame.events.pass({'function':'Controller.assertNodeNotExist()'});
- return true;
- }
-};
-
-//Assert that a form element contains the expected value
-MozMillController.prototype.assertValue = function (el, value) {
- //this.window.focus();
- var n = el.getNode();
-
- if (n && n.value == value){
- frame.events.pass({'function':'Controller.assertValue()'});
- return true;
- }
- throw new Error("could not validate element " + el.getInfo()+" with value "+ value);
- return false;
-};
-
-/**
- * Check if the callback function evaluates to true
- */
-MozMillController.prototype.assert = function(callback, message, thisObject)
-{
- utils.assert(callback, message, thisObject);
-
- frame.events.pass({'function': ": controller.assert('" + callback + "')"});
- return true;
-}
-
-// Assert that the result of a Javascript expression is true
-MozMillController.prototype.assertJS = function(expression, subject) {
- assert(function() {
- return eval(expression)
- }, "controller.assertJS: Failed for '" + expression + "'");
-
- frame.events.pass({'function': "controller.assertJS('" + expression + "')"});
- return true;
-}
-
-//Assert that a provided value is selected in a select element
-MozMillController.prototype.assertSelected = function (el, value) {
- //this.window.focus();
- var n = el.getNode();
- var validator = value;
-
- if (n && n.options[n.selectedIndex].value == validator){
- frame.events.pass({'function':'Controller.assertSelected()'});
- return true;
- }
- throw new Error("could not assert value for element " + el.getInfo()+" with value "+ value);
- return false;
-};
-
-//Assert that a provided checkbox is checked
-MozMillController.prototype.assertChecked = function (el) {
- //this.window.focus();
- var element = el.getNode();
-
- if (element && element.checked == true){
- frame.events.pass({'function':'Controller.assertChecked()'});
- return true;
- }
- throw new Error("assert failed for checked element " + el.getInfo());
- return false;
-};
-
-// Assert that a provided checkbox is not checked
-MozMillController.prototype.assertNotChecked = function (el) {
- var element = el.getNode();
-
- if (!element) {
- throw new Error("Could not find element" + el.getInfo());
- }
-
- if (!element.hasAttribute("checked") || element.checked != true){
- frame.events.pass({'function':'Controller.assertNotChecked()'});
- return true;
- }
- throw new Error("assert failed for not checked element " + el.getInfo());
- return false;
-};
-
-/**
- * Assert that an element's javascript property exists or has a particular value
- *
- * if val is undefined, will return true if the property exists.
- * if val is specified, will return true if the property exists and has the correct value
- */
-MozMillController.prototype.assertJSProperty = function(el, attrib, val) {
- var element = el.getNode();
- if (!element){
- throw new Error("could not find element " + el.getInfo());
- return false;
- }
- var value = element[attrib];
- var res = (value !== undefined && (val === undefined ? true : String(value) == String(val)));
- if (res) {
- frame.events.pass({'function':'Controller.assertJSProperty("' + el.getInfo() + '") : ' + val});
- } else {
- throw new Error("Controller.assertJSProperty(" + el.getInfo() + ") : " +
- (val === undefined ? "property '" + attrib + "' doesn't exist" : val + " == " + value));
- }
- return res;
-};
-
-/**
- * Assert that an element's javascript property doesn't exist or doesn't have a particular value
- *
- * if val is undefined, will return true if the property doesn't exist.
- * if val is specified, will return true if the property doesn't exist or doesn't have the specified value
- */
-MozMillController.prototype.assertNotJSProperty = function(el, attrib, val) {
- var element = el.getNode();
- if (!element){
- throw new Error("could not find element " + el.getInfo());
- return false;
- }
- var value = element[attrib];
- var res = (val === undefined ? value === undefined : String(value) != String(val));
- if (res) {
- frame.events.pass({'function':'Controller.assertNotProperty("' + el.getInfo() + '") : ' + val});
- } else {
- throw new Error("Controller.assertNotJSProperty(" + el.getInfo() + ") : " +
- (val === undefined ? "property '" + attrib + "' exists" : val + " != " + value));
- }
- return res;
-};
-
-/**
- * Assert that an element's dom property exists or has a particular value
- *
- * if val is undefined, will return true if the property exists.
- * if val is specified, will return true if the property exists and has the correct value
- */
-MozMillController.prototype.assertDOMProperty = function(el, attrib, val) {
- var element = el.getNode();
- if (!element){
- throw new Error("could not find element " + el.getInfo());
- return false;
- }
- var value, res = element.hasAttribute(attrib);
- if (res && val !== undefined) {
- value = element.getAttribute(attrib);
- res = (String(value) == String(val));
- }
-
- if (res) {
- frame.events.pass({'function':'Controller.assertDOMProperty("' + el.getInfo() + '") : ' + val});
- } else {
- throw new Error("Controller.assertDOMProperty(" + el.getInfo() + ") : " +
- (val === undefined ? "property '" + attrib + "' doesn't exist" : val + " == " + value));
- }
- return res;
-};
-
-/**
- * Assert that an element's dom property doesn't exist or doesn't have a particular value
- *
- * if val is undefined, will return true if the property doesn't exist.
- * if val is specified, will return true if the property doesn't exist or doesn't have the specified value
- */
-MozMillController.prototype.assertNotDOMProperty = function(el, attrib, val) {
- var element = el.getNode();
- if (!element){
- throw new Error("could not find element " + el.getInfo());
- return false;
- }
- var value, res = element.hasAttribute(attrib);
- if (res && val !== undefined) {
- value = element.getAttribute(attrib);
- res = (String(value) == String(val));
- }
- if (!res) {
- frame.events.pass({'function':'Controller.assertNotDOMProperty("' + el.getInfo() + '") : ' + val});
- } else {
- throw new Error("Controller.assertNotDOMProperty(" + el.getInfo() + ") : " +
- (val == undefined ? "property '" + attrib + "' exists" : val + " == " + value));
- }
- return !res;
-};
-
-// deprecated - Use assertNotJSProperty or assertNotDOMProperty instead
-MozMillController.prototype.assertProperty = function(el, attrib, val) {
- frame.log({'function':'controller.assertProperty() - DEPRECATED',
- 'message':'assertProperty(el, attrib, val) is deprecated. Use assertJSProperty(el, attrib, val) or assertDOMProperty(el, attrib, val) instead'});
- return this.assertJSProperty(el, attrib, val);
-};
-
-// deprecated - Use assertNotJSProperty or assertNotDOMProperty instead
-MozMillController.prototype.assertPropertyNotExist = function(el, attrib) {
- frame.log({'function':'controller.assertPropertyNotExist() - DEPRECATED',
- 'message':'assertPropertyNotExist(el, attrib) is deprecated. Use assertNotJSProperty(el, attrib) or assertNotDOMProperty(el, attrib) instead'});
- return this.assertNotJSProperty(el, attrib);
-};
-
-// Assert that a specified image has actually loaded
-// The Safari workaround results in additional requests
-// for broken images (in Safari only) but works reliably
-MozMillController.prototype.assertImageLoaded = function (el) {
- //this.window.focus();
- var img = el.getNode();
- if (!img || img.tagName != 'IMG') {
- throw new Error('Controller.assertImageLoaded() failed.')
- return false;
- }
- var comp = img.complete;
- var ret = null; // Return value
-
- // Workaround for Safari -- it only supports the
- // complete attrib on script-created images
- if (typeof comp == 'undefined') {
- test = new Image();
- // If the original image was successfully loaded,
- // src for new one should be pulled from cache
- test.src = img.src;
- comp = test.complete;
- }
-
- // Check the complete attrib. Note the strict
- // equality check -- we don't want undefined, null, etc.
- // --------------------------
- // False -- Img failed to load in IE/Safari, or is
- // still trying to load in FF
- if (comp === false) {
- ret = false;
- }
- // True, but image has no size -- image failed to
- // load in FF
- else if (comp === true && img.naturalWidth == 0) {
- ret = false;
- }
- // Otherwise all we can do is assume everything's
- // hunky-dory
- else {
- ret = true;
- }
- if (ret) {
- frame.events.pass({'function':'Controller.assertImageLoaded'});
- } else {
- throw new Error('Controller.assertImageLoaded() failed.')
- }
-
- return ret;
-};
-
-//Drag one eleent to the top x,y coords of another specified element
-MozMillController.prototype.mouseMove = function (doc, start, dest) {
- //if one of these elements couldn't be looked up
- if (typeof start != 'object'){
- throw new Error("received bad coordinates");
- return false;
- }
- if (typeof dest != 'object'){
- throw new Error("received bad coordinates");
- return false;
- }
-
- //Do the initial move to the drag element position
- events.triggerMouseEvent(doc.body, 'mousemove', true, start[0], start[1]);
- events.triggerMouseEvent(doc.body, 'mousemove', true, dest[0], dest[1]);
- frame.events.pass({'function':'Controller.mouseMove()'});
- return true;
-}
-
-// Drag an element to the specified offset on another element, firing mouse and drag events
-// win must be the window both elements are in. Adapted from EventUtils' synthesizeDrop()
-MozMillController.prototype.dragToElement = function(src, dest, offsetX,
- offsetY, aWindow, dropEffect, dragData) {
- srcElement = src.getNode();
- destElement = dest.getNode();
- aWindow = aWindow || srcElement.ownerDocument.defaultView;
- offsetX = offsetX || 20;
- offsetY = offsetY || 20;
-
- var dataTransfer;
-
- var trapDrag = function(event) {
- dataTransfer = event.dataTransfer;
- if(!dragData)
- return;
-
- for (var i = 0; i < dragData.length; i++) {
- var item = dragData[i];
- for (var j = 0; j < item.length; j++) {
- dataTransfer.mozSetDataAt(item[j].type, item[j].data, i);
- }
- }
- dataTransfer.dropEffect = dropEffect || "move";
- event.preventDefault();
- event.stopPropagation();
- }
-
- aWindow.addEventListener("dragstart", trapDrag, true);
- EventUtils.synthesizeMouse(srcElement, 2, 2, { type: "mousedown" }, aWindow);
- EventUtils.synthesizeMouse(srcElement, 11, 11, { type: "mousemove" }, aWindow);
- EventUtils.synthesizeMouse(srcElement, offsetX, offsetY, { type: "mousemove" }, aWindow);
- aWindow.removeEventListener("dragstart", trapDrag, true);
-
- var event = aWindow.document.createEvent("DragEvents");
- event.initDragEvent("dragenter", true, true, aWindow, 0, 0, 0, 0, 0, false, false, false, false, 0, null, dataTransfer);
- destElement.dispatchEvent(event);
-
- var event = aWindow.document.createEvent("DragEvents");
- event.initDragEvent("dragover", true, true, aWindow, 0, 0, 0, 0, 0, false, false, false, false, 0, null, dataTransfer);
- if (destElement.dispatchEvent(event)) {
- EventUtils.synthesizeMouse(destElement, offsetX, offsetY, { type: "mouseup" }, aWindow);
- return "none";
- }
-
- event = aWindow.document.createEvent("DragEvents");
- event.initDragEvent("drop", true, true, aWindow, 0, 0, 0, 0, 0, false, false, false, false, 0, null, dataTransfer);
- destElement.dispatchEvent(event);
- EventUtils.synthesizeMouse(destElement, offsetX, offsetY, { type: "mouseup" }, aWindow);
-
- return dataTransfer.dropEffect;
-}
-
-function preferencesAdditions(controller) {
- var mainTabs = controller.window.document.getAnonymousElementByAttribute(controller.window.document.documentElement, 'anonid', 'selector');
- controller.tabs = {};
- for (var i = 0; i < mainTabs.childNodes.length; i++) {
- var node = mainTabs.childNodes[i];
- var obj = {'button':node}
- controller.tabs[i] = obj;
- var label = node.attributes.item('label').value.replace('pane', '');
- controller.tabs[label] = obj;
- }
- controller.prototype.__defineGetter__("activeTabButton",
- function () {return mainTabs.getElementsByAttribute('selected', true)[0];
- })
-}
-
-function Tabs (controller) {
- this.controller = controller;
-}
-Tabs.prototype.getTab = function(index) {
- return this.controller.window.gBrowser.browsers[index].contentDocument;
-}
-Tabs.prototype.__defineGetter__("activeTab", function() {
- return this.controller.window.gBrowser.selectedBrowser.contentDocument;
-})
-Tabs.prototype.selectTab = function(index) {
- // GO in to tab manager and grab the tab by index and call focus.
-}
-Tabs.prototype.findWindow = function (doc) {
- for (var i = 0; i <= (this.controller.window.frames.length - 1); i++) {
- if (this.controller.window.frames[i].document == doc) {
- return this.controller.window.frames[i];
- }
- }
- throw new Error("Cannot find window for document. Doc title == " + doc.title);
-}
-Tabs.prototype.getTabWindow = function(index) {
- return this.findWindow(this.getTab(index));
-}
-Tabs.prototype.__defineGetter__("activeTabWindow", function () {
- return this.findWindow(this.activeTab);
-})
-Tabs.prototype.__defineGetter__("length", function () {
- return this.controller.window.gBrowser.browsers.length;
-})
-Tabs.prototype.__defineGetter__("activeTabIndex", function() {
- return this.controller.window.gBrowser.tabContainer.selectedIndex;
-})
-Tabs.prototype.selectTabIndex = function(i) {
- this.controller.window.gBrowser.selectTabAtIndex(i);
-}
-
-function browserAdditions (controller) {
- controller.tabs = new Tabs(controller);
-
- controller.waitForPageLoad = function(aDocument, aTimeout, aInterval) {
- var timeout = aTimeout || 30000;
- var owner = null;
-
- // If a user tries to do waitForPageLoad(2000), this will assign the
- // interval the first arg which is most likely what they were expecting
- if (typeof(aDocument) == "number"){
- timeout = aDocument;
- }
-
- // If the document is a tab find the corresponding browser element.
- // Otherwise we have to handle an embedded web page.
- if (aDocument && typeof(aDocument) == "object") {
- owner = this.window.gBrowser.getBrowserForDocument(aDocument);
-
- if (!owner) {
- // If the document doesn't belong to a tab it will be a
- // HTMLDocument of a browser element embedded inside a tab.
- // In such a case use the default window of the document.
- owner = aDocument.defaultView;
- }
- }
-
- // If no owner has been specified, fallback to the selected tab browser
- owner = owner || this.window.gBrowser.selectedBrowser;
-
- // Wait until the content in the tab has been loaded
- this.waitFor(function() {
- return this.isLoaded(owner);
- }, "controller.waitForPageLoad(): Timeout waiting for page loaded.",
- timeout, aInterval, this);
- frame.events.pass({'function':'controller.waitForPageLoad()'});
- }
-}
-
-controllerAdditions = {
- 'Browser:Preferences':preferencesAdditions,
- 'navigator:browser' :browserAdditions,
-}
-
-var withs = {}; Components.utils.import('resource://mozmill/stdlib/withs.js', withs);
-
-MozMillAsyncTest = function (timeout) {
- if (timeout == undefined) {
- this.timeout = 6000;
- } else {
- this.timeout = timeout;
- }
- this._done = false;
- this._mozmillasynctest = true;
-}
-
-MozMillAsyncTest.prototype.run = function () {
- for (var i in this) {
- if (withs.startsWith(i, 'test') && typeof(this[i]) == 'function') {
- this[i]();
- }
- }
-
- utils.waitFor(function() {
- return this._done == true;
- }, "MozMillAsyncTest timed out. Done is " + this._done, 500, 100);
-
- return true;
-}
-
-MozMillAsyncTest.prototype.finish = function () {
- this._done = true;
-}
deleted file mode 100644
--- a/mail/test/resources/mozmill/mozmill/extension/resource/modules/elementslib.js
+++ /dev/null
@@ -1,502 +0,0 @@
-// ***** BEGIN LICENSE BLOCK *****// ***** BEGIN LICENSE BLOCK *****
-// Version: MPL 1.1/GPL 2.0/LGPL 2.1
-//
-// The contents of this file are subject to the Mozilla Public License Version
-// 1.1 (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-// http://www.mozilla.org/MPL/
-//
-// Software distributed under the License is distributed on an "AS IS" basis,
-// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-// for the specific language governing rights and limitations under the
-// License.
-//
-// The Original Code is Mozilla Corporation Code.
-//
-// The Initial Developer of the Original Code is
-// Adam Christian.
-// Portions created by the Initial Developer are Copyright (C) 2008
-// the Initial Developer. All Rights Reserved.
-//
-// Contributor(s):
-// Adam Christian <adam.christian@gmail.com>
-// Mikeal Rogers <mikeal.rogers@gmail.com>
-//
-// Alternatively, the contents of this file may be used under the terms of
-// either the GNU General Public License Version 2 or later (the "GPL"), or
-// the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-// in which case the provisions of the GPL or the LGPL are applicable instead
-// of those above. If you wish to allow use of your version of this file only
-// under the terms of either the GPL or the LGPL, and not to allow others to
-// use your version of this file under the terms of the MPL, indicate your
-// decision by deleting the provisions above and replace them with the notice
-// and other provisions required by the GPL or the LGPL. If you do not delete
-// the provisions above, a recipient may use your version of this file under
-// the terms of any one of the MPL, the GPL or the LGPL.
-//
-// ***** END LICENSE BLOCK *****
-
-var EXPORTED_SYMBOLS = ["Elem", "ID", "Link", "XPath", "Selector", "Name", "Anon", "AnonXPath",
- "Lookup", "_byID", "_byName", "_byAttrib", "_byAnonAttrib",
- ];
-
-var utils = {}; Components.utils.import('resource://mozmill/modules/utils.js', utils);
-var strings = {}; Components.utils.import('resource://mozmill/stdlib/strings.js', strings);
-var arrays = {}; Components.utils.import('resource://mozmill/stdlib/arrays.js', arrays);
-var json2 = {}; Components.utils.import('resource://mozmill/stdlib/json2.js', json2);
-var withs = {}; Components.utils.import('resource://mozmill/stdlib/withs.js', withs);
-var dom = {}; Components.utils.import('resource://mozmill/stdlib/dom.js', dom);
-var objects = {}; Components.utils.import('resource://mozmill/stdlib/objects.js', objects);
-
-var countQuotes = function(str){
- var count = 0;
- var i = 0;
- while(i < str.length) {
- i = str.indexOf('"', i);
- if (i != -1) {
- count++;
- i++;
- } else {
- break;
- }
- }
- return count;
-}
-var smartSplit = function (str) {
- // Note: I would love it if someone good with regular expressions
- // could just replace this function with a good regex
-
- // Ensure we have an even number of quotes
- if (countQuotes(str) % 2 != 0) {
- throw new Error ("Invalid Lookup Expression");
- }
-
- var repls = [];
- while ((str.indexOf('"') != -1) && i <= str.length) {
- var i = str.indexOf('"');
- var s = str.slice(i, str.indexOf('"', i + 1) +1)
- str = str.replace(s, '%$^'+repls.length);
- repls.push(s)
- }
-
- var split = str.split('/');
- var rindex = 0;
- for (var i in split) {
- while (split[i].indexOf('%$^') != -1) {
- var s = split[i];
- var si = rindex;
- split[i] = s.replace('%$^'+si, repls[si]);
- rindex++;
- }
- }
- return split;
-}
-
-
-var ElemBase = function(){
- this.isElement = true;
-}
-ElemBase.prototype.exists = function() {
- if (this.getNode()){ return true; }
- else{ return false; }
-}
-ElemBase.prototype.nodeSearch = function(doc, func, string) {
- var win = doc.defaultView;
- var e = null;
- var element = null;
- //inline function to recursively find the element in the DOM, cross frame.
- var search = function(win, func, string) {
- if (win == null)
- return;
-
- //do the lookup in the current window
- try {
- element = func.call(win, string);
- }
- catch(err) { }
-
- if (!element || (element.length == 0)) {
- var frames = win.frames;
- for (var i=0; i < frames.length; i++) {
- search(frames[i], func, string);
- }
- }
- else { e = element; }
- };
-
- search(win, func, string);
-
- return e;
-}
-
-var Elem = function(node) {
- this.node = node;
- return this;
-}
-Elem.prototype = new utils.Copy(ElemBase.prototype);
-Elem.prototype.getNode = function () { return this.node; };
-Elem.prototype.getInfo = function () { return 'Elem instance.'; };
-
-
-var Selector = function(_document, selector) {
- if (_document == undefined || selector == undefined) {
- throw new Error('Selector constructor did not recieve enough arguments.');
- }
- this._view = _document.defaultView;
- this.selector = selector;
- return this;
-}
-Selector.prototype = new utils.Copy(ElemBase.prototype);
-Selector.prototype.getInfo = function () {
- return "Selector: " + this.selector;
-}
-Selector.prototype.getNodeForDocument = function (s) {
- return this.document.querySelectorAll(s);
-}
-Selector.prototype.getNode = function (index) {
- var nodes = this.nodeSearch(this._view.document, this.getNodeForDocument, this.selector);
- return nodes ? nodes[index || 0] : null;
-}
-
-
-var ID = function(_document, nodeID) {
- if (_document == undefined || nodeID == undefined) {
- throw new Error('ID constructor did not recieve enough arguments.');
- }
- this._view = _document.defaultView;
- this.nodeID = nodeID;
- return this;
-}
-ID.prototype = new utils.Copy(ElemBase.prototype);
-ID.prototype.getInfo = function () {
- return "ID: " + this.nodeID;
-}
-ID.prototype.getNodeForDocument = function (s) {
- return this.document.getElementById(s);
-}
-ID.prototype.getNode = function () {
- return this.nodeSearch(this._view.document, this.getNodeForDocument, this.nodeID);
-}
-
-var Link = function(_document, linkName) {
- if (_document == undefined || linkName == undefined) {
- throw new Error('Link constructor did not recieve enough arguments.');
- }
- this._view = _document.defaultView;
- this.linkName = linkName;
- return this;
-}
-Link.prototype = new utils.Copy(ElemBase.prototype);
-Link.prototype.getInfo = function () {
- return "Link: " + this.linkName;
-}
-Link.prototype.getNodeForDocument = function (linkName) {
- var getText = function(el){
- var text = "";
- if (el.nodeType == 3){ //textNode
- if (el.data != undefined){
- text = el.data;
- }
- else{ text = el.innerHTML; }
- text = text.replace(/n|r|t/g, " ");
- }
- if (el.nodeType == 1){ //elementNode
- for (var i = 0; i < el.childNodes.length; i++) {
- var child = el.childNodes.item(i);
- text += getText(child);
- }
- if (el.tagName == "P" || el.tagName == "BR" ||
- el.tagName == "HR" || el.tagName == "DIV") {
- text += "n";
- }
- }
- return text;
- }
-
- //sometimes the windows won't have this function
- try { var links = this.document.getElementsByTagName('a'); }
- catch(err){ // ADD LOG LINE mresults.write('Error: '+ err, 'lightred');
- }
- for (var i = 0; i < links.length; i++) {
- var el = links[i];
- //if (getText(el).indexOf(this.linkName) != -1) {
- if (el.innerHTML.indexOf(linkName) != -1){
- return el;
- }
- }
- return null;
-}
-
-Link.prototype.getNode = function () {
- return this.nodeSearch(this._view.document, this.getNodeForDocument, this.linkName);
-}
-
-var XPath = function(_document, expr) {
- if (_document == undefined || expr == undefined) {
- throw new Error('XPath constructor did not recieve enough arguments.');
- }
- this._view = _document.defaultView;
- this.expr = expr;
- return this;
-}
-XPath.prototype = new utils.Copy(ElemBase.prototype);
-XPath.prototype.getInfo = function () {
- return "XPath: " + this.expr;
-}
-XPath.prototype.getNodeForDocument = function (s) {
- var aNode = this.document;
- var aExpr = s;
- var xpe = null;
-
- if (this.document.defaultView == null) {
- xpe = new getMethodInWindows('XPathEvaluator')();
- } else {
- xpe = new this.document.defaultView.XPathEvaluator();
- }
- var nsResolver = xpe.createNSResolver(aNode.ownerDocument == null ?
- aNode.documentElement : aNode.ownerDocument.documentElement);
- var result = xpe.evaluate(aExpr, aNode, nsResolver, 0, null);
- var found = [];
- var res;
- while (res = result.iterateNext())
- found.push(res);
- return found[0];
-}
-
-XPath.prototype.getNode = function () {
- return this.nodeSearch(this._view.document, this.getNodeForDocument, this.expr);
-}
-
-var Name = function(_document, nName) {
- if (_document == undefined || nName == undefined) {
- throw new Error('Name constructor did not recieve enough arguments.');
- }
- this._view = _document.defaultView;
- this.nName = nName;
- return this;
-}
-Name.prototype = new utils.Copy(ElemBase.prototype);
-Name.prototype.getInfo = function () {
- return "Name: " + this.nName;
-}
-Name.prototype.getNodeForDocument = function (s) {
- try{
- var els = this.document.getElementsByName(s);
- if (els.length > 0) { return els[0]; }
- }
- catch(err){};
- return null;
-}
-
-Name.prototype.getNode = function () {
- return this.nodeSearch(this._view.document, this.getNodeForDocument, this.nName);
-}
-
-
-function Lookup (_document, expression) {
- if (_document == undefined || expression == undefined) {
- throw new Error('Lookup constructor did not recieve enough arguments.');
- }
- this._view = _document.defaultView;
- this.expression = expression;
-}
-Lookup.prototype = new utils.Copy(ElemBase.prototype);
-var _returnResult = function (results) {
- if (results.length == 0) {
- return null
- } else if (results.length == 1) {
- return results[0];
- } else {
- return results;
- }
-}
-var _forChildren = function (element, name, value) {
- var results = [];
- var nodes = [e for each (e in element.childNodes) if (e)]
- for (var i in nodes) {
- var n = nodes[i];
- if (n[name] == value) {
- results.push(n);
- }
- }
- return results;
-}
-var _forAnonChildren = function (_document, element, name, value) {
- var results = [];
- var nodes = [e for each (e in _document.getAnoymousNodes(element)) if (e)];
- for (var i in nodes ) {
- var n = nodes[i];
- if (n[name] == value) {
- results.push(n);
- }
- }
- return results;
-}
-var _byID = function (_document, parent, value) {
- return _returnResult(_forChildren(parent, 'id', value));
-}
-var _byName = function (_document, parent, value) {
- return _returnResult(_forChildren(parent, 'tagName', value));
-}
-var _byAttrib = function (parent, attributes) {
- var results = [];
-
- var nodes = parent.childNodes;
- for (var i in nodes) {
- var n = nodes[i];
- requirementPass = 0;
- requirementLength = 0;
- for (var a in attributes) {
- requirementLength++;
- try {
- if (n.getAttribute(a) == attributes[a]) {
- requirementPass++;
- }
- } catch (err) {
- // Workaround any bugs in custom attribute crap in XUL elements
- }
- }
- if (requirementPass == requirementLength) {
- results.push(n);
- }
- }
- if (results.length == 0) {
- }
- return _returnResult(results)
-}
-var _byAnonAttrib = function (_document, parent, attributes) {
- var results = [];
-
- if (objects.getLength(attributes) == 1) {
- for (var i in attributes) {var k = i; var v = attributes[i]; }
- var result = _document.getAnonymousElementByAttribute(parent, k, v)
- if (result) {
- return result;
-
- }
- }
- var nodes = [n for each (n in _document.getAnonymousNodes(parent)) if (n.getAttribute)];
- function resultsForNodes (nodes) {
- for (var i in nodes) {
- var n = nodes[i];
- requirementPass = 0;
- requirementLength = 0;
- for (var a in attributes) {
- requirementLength++;
- if (n.getAttribute(a) == attributes[a]) {
- requirementPass++;
- }
- }
- if (requirementPass == requirementLength) {
- results.push(n);
- }
- }
- }
- resultsForNodes(nodes)
- if (results.length == 0) {
- resultsForNodes([n for each (n in parent.childNodes) if (n != undefined && n.getAttribute)])
- }
- return _returnResult(results)
-}
-var _byIndex = function (_document, parent, i) {
- return parent.childNodes[i];
-}
-var _anonByName = function (_document, parent, value) {
- return _returnResult(_forAnonChildren(_document, parent, 'tagName', value));
-}
-var _anonByAttrib = function (_document, parent, value) {
- return _byAnonAttrib(_document, parent, value);
-}
-var _anonByIndex = function (_document, parent, i) {
- return _document.getAnonymousNodes(parent)[i];
-}
-
-Lookup.prototype.getInfo = function () {
- return "Lookup: "+ this.expression;
-}
-Lookup.prototype.exists = function () {
- try {
- var e = this.getNode();
- } catch (ex) {
- return false;
- }
- if (e) {
- return true;
- }
- return false;
-}
-Lookup.prototype.getNode = function () {
- var expSplit = [e for each (e in smartSplit(this.expression) ) if (e != '')];
- expSplit.unshift(this._view.document)
- _document = this._view.document;
- var nCases = {'id':_byID, 'name':_byName, 'attrib':_byAttrib, 'index':_byIndex};
- var aCases = {'name':_anonByName, 'attrib':_anonByAttrib, 'index':_anonByIndex};
- var reduceLookup = function (parent, exp) {
- // Handle case where only index is provided
- var cases = nCases;
-
- // Handle ending index before any of the expression gets mangled
- if (withs.endsWith(exp, ']')) {
- var expIndex = json2.JSON.parse(strings.vslice(exp, '[', ']'));
- }
- // Handle anon
- if (withs.startsWith(exp, 'anon')) {
- var exp = strings.vslice(exp, '(', ')');
- var cases = aCases;
- }
- if (withs.startsWith(exp, '[')) {
- try {
- var obj = json2.JSON.parse(strings.vslice(exp, '[', ']'))
- } catch (err) {
- throw new Error(err+'. String to be parsed was || '+strings.vslice(exp, '[', ']')+' ||');
- }
- var r = cases['index'](_document, parent, obj);
- if (r == null) {
- throw new Error('Expression "'+exp+'" returned null. Anonymous == '+(cases == aCases));
- }
- return r;
- }
-
- for (var c in cases) {
- if (withs.startsWith(exp, c)) {
- try {
- var obj = json2.JSON.parse(strings.vslice(exp, '(', ')'))
- } catch(err) {
- throw new Error(err+'. String to be parsed was || '+strings.vslice(exp, '(', ')')+' ||');
- }
- var result = cases[c](_document, parent, obj);
- }
- }
-
- if (!result) {
- if ( withs.startsWith(exp, '{') ) {
- try {
- var obj = json2.JSON.parse(exp)
- } catch(err) {
- throw new Error(err+'. String to be parsed was || '+exp+' ||');
- }
-
- if (cases == aCases) {
- var result = _anonByAttrib(_document, parent, obj)
- } else {
- var result = _byAttrib(parent, obj)
- }
- }
- if (!result) {
- throw new Error('Expression "'+exp+'" returned null. Anonymous == '+(cases == aCases));
- }
- }
-
- // Final return
- if (expIndex) {
- // TODO: Check length and raise error
- return result[expIndex];
- } else {
- // TODO: Check length and raise error
- return result;
- }
- // Maybe we should cause an exception here
- return false
- }
- return expSplit.reduce(reduceLookup);
-}
deleted file mode 100644
--- a/mail/test/resources/mozmill/mozmill/extension/resource/modules/events.js
+++ /dev/null
@@ -1,184 +0,0 @@
-// ***** BEGIN LICENSE BLOCK *****
-// Version: MPL 1.1/GPL 2.0/LGPL 2.1
-//
-// The contents of this file are subject to the Mozilla Public License Version
-// 1.1 (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-// http://www.mozilla.org/MPL/
-//
-// Software distributed under the License is distributed on an "AS IS" basis,
-// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-// for the specific language governing rights and limitations under the
-// License.
-//
-// The Original Code is Mozilla Corporation Code.
-//
-// The Initial Developer of the Original Code is
-// Adam Christian.
-// Portions created by the Initial Developer are Copyright (C) 2008
-// the Initial Developer. All Rights Reserved.
-//
-// Contributor(s):
-// Adam Christian <adam.christian@gmail.com>
-// Mikeal Rogers <mikeal.rogers@gmail.com>
-// Henrik Skupin <hskupin@mozilla.com>
-//
-// Alternatively, the contents of this file may be used under the terms of
-// either the GNU General Public License Version 2 or later (the "GPL"), or
-// the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-// in which case the provisions of the GPL or the LGPL are applicable instead
-// of those above. If you wish to allow use of your version of this file only
-// under the terms of either the GPL or the LGPL, and not to allow others to
-// use your version of this file under the terms of the MPL, indicate your
-// decision by deleting the provisions above and replace them with the notice
-// and other provisions required by the GPL or the LGPL. If you do not delete
-// the provisions above, a recipient may use your version of this file under
-// the terms of any one of the MPL, the GPL or the LGPL.
-//
-// ***** END LICENSE BLOCK *****
-
-var EXPORTED_SYMBOLS = ["createEventObject", "triggerEvent", "getKeyCodeFromKeySequence",
- "triggerKeyEvent", "triggerMouseEvent", "fakeOpenPopup"];
-
-var EventUtils = {}; Components.utils.import('resource://mozmill/stdlib/EventUtils.js', EventUtils);
-
-var utils = {}; Components.utils.import('resource://mozmill/modules/utils.js', utils);
-
-// var logging = {}; Components.utils.import('resource://mozmill/stdlib/logging.js', logging);
-
-// var eventsLogger = logging.getLogger('eventsLogger');
-
-var createEventObject = function(element, controlKeyDown, altKeyDown, shiftKeyDown, metaKeyDown) {
- var evt = element.ownerDocument.createEventObject();
- evt.shiftKey = shiftKeyDown;
- evt.metaKey = metaKeyDown;
- evt.altKey = altKeyDown;
- evt.ctrlKey = controlKeyDown;
- return evt;
-};
-
-/**
- * Fakes a click on a menupopup
- *
- * @param window aWindow
- * Browser window to use
- * @param menupopup aPopup
- * Popup to fake the click for
- */
-function fakeOpenPopup(aWindow, aPopup) {
- var popupEvent = aWindow.document.createEvent("MouseEvent");
- popupEvent.initMouseEvent("popupshowing", true, true, aWindow, 0,
- 0, 0, 0, 0, false, false, false, false,
- 0, null);
- aPopup.dispatchEvent(popupEvent);
-}
-
- /* Fire an event in a browser-compatible manner */
-var triggerEvent = function(element, eventType, canBubble, controlKeyDown, altKeyDown, shiftKeyDown, metaKeyDown) {
- canBubble = (typeof(canBubble) == undefined) ? true: canBubble;
- var evt = element.ownerDocument.createEvent('HTMLEvents');
-
- evt.shiftKey = shiftKeyDown;
- evt.metaKey = metaKeyDown;
- evt.altKey = altKeyDown;
- evt.ctrlKey = controlKeyDown;
-
- evt.initEvent(eventType, canBubble, true);
- element.dispatchEvent(evt);
-
-};
-
-var getKeyCodeFromKeySequence = function(keySequence) {
-
- var match = /^\\(\d{1,3})$/.exec(keySequence);
- if (match != null) {
- return match[1];
-
- }
- match = /^.$/.exec(keySequence);
- if (match != null) {
- return match[0].charCodeAt(0);
-
- }
- // this is for backward compatibility with existing tests
- // 1 digit ascii codes will break however because they are used for the digit chars
- match = /^\d{2,3}$/.exec(keySequence);
- if (match != null) {
- return match[0];
-
- }
- if (keySequence != null){
- // eventsLogger.error("invalid keySequence "+String(keySequence));
- }
- // mozmill.results.writeResult("invalid keySequence");
-}
-
-var triggerKeyEvent = function(element, eventType, aKey, modifiers, expectedEvent) {
- // get the window and send focus event
- var win = element.ownerDocument ? element.ownerDocument.defaultView : element;
- win.focus();
- utils.sleep(5);
-
- // If we have an element check if it needs to be focused
- if (element.ownerDocument) {
- var focusedElement = utils.getChromeWindow(win).document.commandDispatcher.focusedElement;
- for (var node = focusedElement; node && node != element; )
- node = node.parentNode;
-
- // Only focus the element when it's not focused yet
- if (!node)
- element.focus();
- }
-
- if (expectedEvent) {
- // The expected event type has to be set
- if (!expectedEvent.type)
- throw new Error(arguments.callee.name + ": Expected event type not specified");
-
- // If no target has been specified use the specified element
- var target = expectedEvent.target ? expectedEvent.target.getNode() : element;
- if (!target) {
- throw new Error(arguments.callee.name + ": could not find element " +
- expectedEvent.target.getInfo());
- }
-
- EventUtils.synthesizeKeyExpectEvent(aKey, modifiers, target,
- expectedEvent.type,
- "events.triggerKeyEvent()", win);
- } else {
- EventUtils.synthesizeKey(aKey, modifiers, win);
- }
-}
-
- /* Fire a mouse event in a browser-compatible manner */
-var triggerMouseEvent = function(element, eventType, canBubble, clientX, clientY, controlKeyDown, altKeyDown, shiftKeyDown, metaKeyDown) {
-
- clientX = clientX ? clientX: 0;
- clientY = clientY ? clientY: 0;
-
- // Fixing this - make the mouse understand where it is on the screen, needed
- // for double click.
- var screenX = element.boxObject.screenX ? element.boxObject.screenX : 0;
- var screenY = element.boxObject.screenY ? element.boxObject.screenY : 0;;
-
- canBubble = (typeof(canBubble) == undefined) ? true: canBubble;
-
- var evt = element.ownerDocument.defaultView.document.createEvent('MouseEvents');
- if (evt.initMouseEvent) {
- //LOG.info("element has initMouseEvent");
- //Safari
- evt.initMouseEvent(eventType, canBubble, true, element.ownerDocument.defaultView, 1, screenX, screenY, clientX, clientY, controlKeyDown, altKeyDown, shiftKeyDown, metaKeyDown, 0, null)
-
- }
- else {
- //LOG.warn("element doesn't have initMouseEvent; firing an event which should -- but doesn't -- have other mouse-event related attributes here, as well as controlKeyDown, altKeyDown, shiftKeyDown, metaKeyDown");
- evt.initEvent(eventType, canBubble, true);
- evt.shiftKey = shiftKeyDown;
- evt.metaKey = metaKeyDown;
- evt.altKey = altKeyDown;
- evt.ctrlKey = controlKeyDown;
-
- }
- //Used by safari
- element.dispatchEvent(evt);
-}
deleted file mode 100644
--- a/mail/test/resources/mozmill/mozmill/extension/resource/modules/frame.js
+++ /dev/null
@@ -1,685 +0,0 @@
-// ***** BEGIN LICENSE BLOCK *****// ***** BEGIN LICENSE BLOCK *****
-// Version: MPL 1.1/GPL 2.0/LGPL 2.1
-//
-// The contents of this file are subject to the Mozilla Public License Version
-// 1.1 (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-// http://www.mozilla.org/MPL/
-//
-// Software distributed under the License is distributed on an "AS IS" basis,
-// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-// for the specific language governing rights and limitations under the
-// License.
-//
-// The Original Code is Mozilla Corporation Code.
-//
-// The Initial Developer of the Original Code is
-// Mikeal Rogers.
-// Portions created by the Initial Developer are Copyright (C) 2008
-// the Initial Developer. All Rights Reserved.
-//
-// Contributor(s):
-// Mikeal Rogers <mikeal.rogers@gmail.com>
-//
-// Alternatively, the contents of this file may be used under the terms of
-// either the GNU General Public License Version 2 or later (the "GPL"), or
-// the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-// in which case the provisions of the GPL or the LGPL are applicable instead
-// of those above. If you wish to allow use of your version of this file only
-// under the terms of either the GPL or the LGPL, and not to allow others to
-// use your version of this file under the terms of the MPL, indicate your
-// decision by deleting the provisions above and replace them with the notice
-// and other provisions required by the GPL or the LGPL. If you do not delete
-// the provisions above, a recipient may use your version of this file under
-// the terms of any one of the MPL, the GPL or the LGPL.
-//
-// ***** END LICENSE BLOCK *****
-
-var EXPORTED_SYMBOLS = ['loadFile','register_function','Collector','Runner','events',
- 'jsbridge', 'runTestDirectory', 'runTestFile', 'log', 'getThread',
- 'timers', 'persisted'];
-
-var httpd = {}; Components.utils.import('resource://mozmill/stdlib/httpd.js', httpd);
-var os = {}; Components.utils.import('resource://mozmill/stdlib/os.js', os);
-var strings = {}; Components.utils.import('resource://mozmill/stdlib/strings.js', strings);
-var arrays = {}; Components.utils.import('resource://mozmill/stdlib/arrays.js', arrays);
-var withs = {}; Components.utils.import('resource://mozmill/stdlib/withs.js', withs);
-var utils = {}; Components.utils.import('resource://mozmill/modules/utils.js', utils);
-var securableModule = {};
- Components.utils.import('resource://mozmill/stdlib/securable-module.js', securableModule);
-
-var aConsoleService = Components.classes["@mozilla.org/consoleservice;1"].
- getService(Components.interfaces.nsIConsoleService);
-var ios = Components.classes["@mozilla.org/network/io-service;1"]
- .getService(Components.interfaces.nsIIOService);
-var loader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
- .getService(Components.interfaces.mozIJSSubScriptLoader);
-var uuidgen = Components.classes["@mozilla.org/uuid-generator;1"]
- .getService(Components.interfaces.nsIUUIDGenerator);
-
-var backstage = this;
-
-var registeredFunctions = {};
-
-var persisted = {};
-
-arrayRemove = function(array, from, to) {
- var rest = array.slice((to || from) + 1 || array.length);
- array.length = from < 0 ? array.length + from : from;
- return array.push.apply(array, rest);
-};
-
-mozmill = undefined; elementslib = undefined;
-var loadTestResources = function () {
- if (mozmill == undefined) {
- mozmill = {};
- Components.utils.import("resource://mozmill/modules/mozmill.js", mozmill);
- }
- if (elementslib == undefined) {
- elementslib = {};
- Components.utils.import("resource://mozmill/modules/elementslib.js", elementslib);
- }
-}
-
-var loadFile = function(path, collector) {
- var file = Components.classes["@mozilla.org/file/local;1"]
- .createInstance(Components.interfaces.nsILocalFile);
- file.initWithPath(path);
- var uri = ios.newFileURI(file).spec;
-
- var module = {};
- module.registeredFunctions = registeredFunctions;
- module.collector = collector
- loadTestResources();
- module.mozmill = mozmill;
- module.elementslib = elementslib;
- module.persisted = persisted;
- module.Cc = Components.classes;
- module.Ci = Components.interfaces;
- module.Cu = Components.utils;
- module.require = function (mod) {
- var loader = new securableModule.Loader({
- rootPaths: [ios.newFileURI(file.parent).spec],
- defaultPrincipal: "system",
- globals : { mozmill: mozmill,
- elementslib: elementslib,
- persisted: persisted,
- Cc: Components.classes,
- Ci: Components.interfaces,
- Cu: Components.utils }
- });
- return loader.require(mod);
- }
-
- if (collector != undefined) {
- collector.current_file = file;
- collector.current_path = path;
- }
- try {
- loader.loadSubScript(uri, module, "UTF-8");
- } catch(e) {
- events.fail(e);
- var obj = {
- 'filename':path,
- 'passed':false,
- 'failed':true,
- 'passes':0,
- 'fails' :1,
- 'name' :'Unknown Test',
- };
- events.fireEvent('endTest', obj);
- Components.utils.reportError(e);
- }
-
- module.__file__ = path;
- module.__uri__ = uri;
- return module;
-}
-
-function registerFunction (name, func) {
- registeredFunctions[name] = func;
-}
-
-function stateChangeBase (possibilties, restrictions, target, cmeta, v) {
- if (possibilties) {
- if (!arrays.inArray(possibilties, v)) {
- // TODO Error value not in this.poss
- return;
- }
- }
- if (restrictions) {
- for (var i in restrictions) {
- var r = restrictions[i];
- if (!r(v)) {
- // TODO error value did not pass restriction
- return;
- }
- }
- }
- // Fire jsbridge notification, logging notification, listener notifications
- events[target] = v;
- events.fireEvent(cmeta, target);
-}
-
-timers = [];
-
-var events = {
- 'currentState' : null,
- 'currentModule': null,
- 'currentTest' : null,
- 'userShutdown' : false,
- 'appQuit' : false,
- 'listeners' : {},
-}
-events.setState = function (v) {
- return stateChangeBase(['dependencies', 'setupModule', 'teardownModule',
- 'setupTest', 'teardownTest', 'test', 'collection'],
- null, 'currentState', 'setState', v);
-}
-events.toggleUserShutdown = function (){
- if (this.userShutdown) {
- this.fail({'function':'frame.events.toggleUserShutdown', 'message':'Shutdown expected but none detected before timeout'});
- }
- this.userShutdown = (!this.userShutdown);
-}
-events.isUserShutdown = function () {
- return this.userShutdown;
-}
-events.setTest = function (test, invokedFromIDE) {
- test.__passes__ = [];
- test.__fails__ = [];
- test.__invokedFromIDE__ = invokedFromIDE;
- events.currentTest = test;
- var obj = {'filename':events.currentModule.__file__,
- 'name':test.__name__,
- }
- events.fireEvent('setTest', obj);
-}
-events.endTest = function (test) {
- test.status = 'done';
- events.currentTest = null;
- var obj = {'filename':events.currentModule.__file__,
- 'passed':test.__passes__.length,
- 'failed':test.__fails__.length,
- 'passes':test.__passes__,
- 'fails' :test.__fails__,
- 'name' :test.__name__,
- }
- if (test.skipped) {
- obj['skipped'] = true;
- obj.skipped_reason = test.skipped_reason;
- }
- if (test.meta) {
- obj.meta = test.meta;
- }
- events.fireEvent('endTest', obj);
-}
-events.setModule = function (v) {
- return stateChangeBase( null, [function (v) {return (v.__file__ != undefined)}],
- 'currentModule', 'setModule', v);
-}
-events.pass = function (obj) {
- if (events.currentTest) {
- events.currentTest.__passes__.push(obj);
- }
- for each(var timer in timers) {
- timer.actions.push(
- {"currentTest":events.currentModule.__file__+"::"+events.currentTest.__name__, "obj":obj,
- "result":"pass"}
- );
- }
- events.fireEvent('pass', obj);
-}
-events.fail = function (obj) {
- var error = obj.exception;
- if(error) {
- // Error objects aren't enumerable https://bugzilla.mozilla.org/show_bug.cgi?id=637207
- obj.exception = {
- name: error.name,
- message: error.message,
- lineNumber: error.lineNumber,
- fileName: error.fileName,
- stack: error.stack
- };
- }
- // a low level event, such as a keystroke, fails
- if (events.currentTest) {
- events.currentTest.__fails__.push(obj);
- }
- for each(var time in timers) {
- timer.actions.push(
- {"currentTest":events.currentModule.__file__+"::"+events.currentTest.__name__, "obj":obj,
- "result":"fail"}
- );
- }
- events.fireEvent('fail', obj);
-}
-events.skip = function (reason) {
- events.currentTest.skipped = true;
- events.currentTest.skipped_reason = reason;
- for each(var timer in timers) {
- timer.actions.push(
- {"currentTest":events.currentModule.__file__+"::"+events.currentTest.__name__, "obj":reason,
- "result":"skip"}
- );
- }
- events.fireEvent('skip', reason);
-}
-events.fireEvent = function (name, obj) {
- if (events.currentTest && name == "firePythonCallback" && events.currentTest.__invokedFromIDE__) {
- throw new Error("tests that use firePythonCallback cannot be run from the IDE\n");
- }
- if (this.listeners[name]) {
- for (var i in this.listeners[name]) {
- this.listeners[name][i](obj);
- }
- }
- for each(var listener in this.globalListeners) {
- listener(name, obj);
- }
-}
-events.globalListeners = [];
-events.addListener = function (name, listener) {
- if (this.listeners[name]) {
- this.listeners[name].push(listener);
- } else if (name =='') {
- this.globalListeners.push(listener)
- } else {
- this.listeners[name] = [listener];
- }
-}
-events.removeListener = function(listener) {
- for (var listenerIndex in this.listeners) {
- var e = this.listeners[listenerIndex];
- for (var i in e){
- if (e[i] == listener) {
- this.listeners[listenerIndex] = arrayRemove(e, i);
- }
- }
- }
- for (var i in this.globalListeners) {
- if (this.globalListeners[i] == listener) {
- this.globalListeners = arrayRemove(this.globalListeners, i);
- }
- }
-}
-
-var log = function (obj) {
- events.fireEvent('log', obj);
-}
-
-try {
- var jsbridge = {}; Components.utils.import('resource://jsbridge/modules/events.js', jsbridge);
-} catch(err) {
- var jsbridge = null;
-
- aConsoleService.logStringMessage("jsbridge not available.");
-}
-
-if (jsbridge) {
- events.addListener('', function (name, obj) {jsbridge.fireEvent('mozmill.'+name, obj)} );
-}
-
-var http_server = httpd.getServer(43336);
-
-function Collector () {
- this.test_modules_by_filename = {};
- this.test_modules_by_name = {};
- this.requirements_run = {};
- this.all_requirements = [];
- this.loaded_directories = [];
- this.testing = [];
- this.httpd_started = false;
- this.http_port = 43336;
- // var logging = {}; Components.utils.import('resource://mozmill/stdlib/logging.js', logging);
- // this.logger = new logging.Logger('Collector');
-}
-
-Collector.prototype.getModule = function (name) {
- return this.test_modules_by_name[name];
-}
-
-Collector.prototype.startHttpd = function () {
- while (this.httpd == undefined) {
- try {
- http_server.start(this.http_port);
- this.httpd = http_server;
- } catch(e) { // Failure most likely due to port conflict
- this.http_port++;
- http_server = httpd.getServer(this.http_port);
- };
-
-
- }
-}
-Collector.prototype.stopHttpd = function () {
- if (this.httpd) {
- this.httpd.stop(function(){}); // Callback needed to pause execution until the server has been properly shutdown
- this.httpd = null;
- }
-}
-Collector.prototype.addHttpResource = function (directory, ns) {
- if (!this.httpd) {
- this.startHttpd();
- }
-
- if (!ns) {
- ns = '/';
- } else {
- ns = '/' + ns + '/';
- }
-
- var lp = Components.classes["@mozilla.org/file/local;1"].
- createInstance(Components.interfaces.nsILocalFile);
- lp.initWithPath(os.abspath(directory, this.current_file));
- this.httpd.registerDirectory(ns, lp);
-
- return 'http://localhost:' + this.http_port + ns
-}
-
-Collector.prototype.initTestModule = function (filename) {
- var test_module = loadFile(filename, this);
- test_module.__tests__ = [];
- for (var i in test_module) {
- if (test_module[i] == null) {
- // do nothing
- }
- else if (typeof(test_module[i]) == "function") {
- if (i == "setupTest") {
- test_module[i].__name__ = i;
- test_module.__setupTest__ = test_module[i];
- } else if (i == "setupModule") {
- test_module[i].__name__ = i;
- test_module.__setupModule__ = test_module[i];
- } else if (i == "teardownTest") {
- test_module[i].__name__ = i;
- test_module.__teardownTest__ = test_module[i];
- } else if (i == "teardownModule") {
- test_module[i].__name__ = i;
- test_module.__teardownModule__ = test_module[i];
- } else if (withs.startsWith(i, "test")) {
- test_module[i].__name__ = i;
- test_module.__tests__.push(test_module[i]);
- }
- } else if (typeof(test_module[i]) == 'object' &&
- test_module[i]._mozmillasynctest == true) {
- test_module[i].__name__ = i;
- test_module.__tests__.push(test_module[i]);
- }
- if (i == "RELATIVE_ROOT") {
- test_module.__root_path__ = os.abspath(test_module[i], os.getFileForPath(filename));
- }
- if (i == "MODULE_REQUIRES") {
- test_module.__requirements__ = test_module[i];
- this.all_requirements.push.apply(backstage, test_module[i]);
- }
- if (i == "MODULE_NAME") {
- test_module.__module_name__ = test_module[i];
- this.test_modules_by_name[test_module[i]] = test_module;
- }
- }
-
- if (test_module.MODULE_REQUIRES != undefined && test_module.RELATIVE_ROOT == undefined) {
- for each(var t in test_module.__tests__) {
- t.__force_skip__ = "RELATIVE ROOT is not defined and test requires another module.";
- }
- }
-
- test_module.collector = this;
- test_module.status = 'loaded';
- this.test_modules_by_filename[filename] = test_module;
-
- return test_module;
-}
-
-Collector.prototype.initTestDirectory = function (directory) {
- var r = this;
- function recursiveModuleLoader(dfile) {
- r.loaded_directories.push(directory);
- var dfiles = os.listDirectory(dfile);
- for (var i in dfiles) {
- var f = dfiles[i];
- if ( f.isDirectory() &&
- !withs.startsWith(f.leafName, '.') &&
- withs.startsWith(f.leafName, "test") &&
- !arrays.inArray(r.loaded_directories, f.path) ) {
- recursiveModuleLoader(os.getFileForPath(f.path));
- } else if ( withs.startsWith(f.leafName, "test") &&
- withs.endsWith(f.leafName, ".js") &&
- !arrays.inArray(r.test_modules_by_filename, f.path) ) {
- r.initTestModule(f.path);
- }
- r.testing.push(f.path);
- }
- }
- recursiveModuleLoader(os.getFileForPath(directory));
-}
-
-// Observer which gets notified when the application quits
-function AppQuitObserver() {
- this.register();
-}
-AppQuitObserver.prototype = {
- observe: function(subject, topic, data) {
- events.appQuit = true;
- },
- register: function() {
- var obsService = Components.classes["@mozilla.org/observer-service;1"]
- .getService(Components.interfaces.nsIObserverService);
- obsService.addObserver(this, "quit-application", false);
- },
- unregister: function() {
- var obsService = Components.classes["@mozilla.org/observer-service;1"]
- .getService(Components.interfaces.nsIObserverService);
- obsService.removeObserver(this, "quit-application");
- }
-}
-
-
-function Runner (collector, invokedFromIDE) {
- this.collector = collector;
- this.invokedFromIDE = invokedFromIDE
- events.fireEvent('startRunner', true);
- // var logging = {}; Components.utils.import('resource://mozmill/stdlib/logging.js', logging);
- // this.logger = new logging.Logger('Runner');
- var m = {}; Components.utils.import('resource://mozmill/modules/mozmill.js', m);
- this.platform = m.platform;
-}
-Runner.prototype.runTestDirectory = function (directory) {
- this.collector.initTestDirectory(directory);
-
- for (var i in this.collector.test_modules_by_filename) {
- var test = this.collector.test_modules_by_filename[i];
- if (test.status != 'done') {
- this.runTestModule(test);
- }
- }
-}
-Runner.prototype.runTestFile = function (filename) {
- // if ( !arrays.inArray(this.test_modules_by_filename, directory) ) {
- // this.collector.initTestModule(directory);
- // }
- this.collector.initTestModule(filename);
- this.runTestModule(this.collector.test_modules_by_filename[filename]);
-}
-Runner.prototype.end = function () {
- try {
- events.fireEvent('persist', persisted);
- } catch(e) {
- events.fireEvent('error', "persist serialization failed.");
- }
- this.collector.stopHttpd();
- events.fireEvent('endRunner', true);
-}
-Runner.prototype.getDependencies = function (module) {
- events.setState('dependencies');
- var alldeps = [];
- function recursiveGetDeps (mod) {
- for (var i in mod.__dependencies__) {
- var m = mod.dependencies[i];
- if ( !arrays.inArray(this.test_modules_by_name, m) ) {
- // TODO: Raise Error that this dependency cannot be resolved.
- } else {
- recursiveGetDeps(this.test_modules_by_name[m]);
- alldeps.push(m);
- }
- }
- }
-
- return alldeps;
-}
-
-Runner.prototype.wrapper = function (func, arg) {
- thread = Components.classes["@mozilla.org/thread-manager;1"]
- .getService(Components.interfaces.nsIThreadManager)
- .currentThread;
-
- if (func.EXCLUDED_PLATFORMS != undefined) {
- if (arrays.inArray(func.EXCLUDED_PLATFORMS, this.platform)) {
- events.skip("Platform exclusion");
- return;
- }
- }
- if (func.__force_skip__ != undefined) {
- events.skip(func.__force_skip__);
- return;
- }
- try {
- if (arg) {
- func(arg);
- } else {
- if (func._mozmillasynctest == true) {
- func.run();
- } else {
- func();
- }
- }
- // If a shutdown was expected but the application hasn't quit, throw a failure
- if (events.isUserShutdown()) {
- utils.sleep(500); // Prevents race condition between mozrunner hard process kill and normal FFx shutdown
- if (!events.appQuit) {
- events.fail({'function':'Runner.wrapper', 'message':'Shutdown expected but none detected before end of test'});
- }
- }
- } catch (e) {
- if (func._mozmillasynctest == true) {
- func = {
- 'filename':events.currentModule.__file__,
- 'name':func.__name__
- }
- }
- // Allow the exception if a user shutdown was expected
- if (!events.isUserShutdown()) {
- events.fail({'exception': e, 'test':func})
- Components.utils.reportError(e);
- }
- }
-}
-
-Runner.prototype._runTestModule = function (module) {
- if (module.__requirements__ != undefined && module.__force_skip__ == undefined) {
- for each(var req in module.__requirements__) {
- module[req] = this.collector.getModule(req);
- }
- }
-
- var attrs = [];
- for (var i in module) {
- attrs.push(i);
- }
-
- events.setModule(module);
- module.__status__ = 'running';
- if (module.__setupModule__) {
- events.setState('setupModule');
- events.setTest(module.__setupModule__);
- this.wrapper(module.__setupModule__, module);
- var setupModulePassed = (events.currentTest.__fails__.length == 0 && !events.currentTest.skipped);
- events.endTest(module.__setupModule__);
- } else {
- var setupModulePassed = true;
- }
- if (setupModulePassed) {
- var observer = new AppQuitObserver();
- for (var i in module.__tests__) {
- events.appQuit = false;
- var test = module.__tests__[i];
-
- // TODO: introduce per-test timeout:
- // https://bugzilla.mozilla.org/show_bug.cgi?id=574871
-
- if (module.__setupTest__) {
- events.setState('setupTest');
- events.setTest(module.__setupTest__);
- this.wrapper(module.__setupTest__, test);
- var setupTestPassed = (events.currentTest.__fails__.length == 0 && !events.currentTest.skipped);
- events.endTest(module.__setupTest__);
- } else {
- var setupTestPassed = true;
- }
- events.setState('test');
- events.setTest(test, this.invokedFromIDE);
- if (setupTestPassed) {
- this.wrapper(test);
- } else {
- events.skip("setupTest failed.");
- }
- if (module.__teardownTest__) {
- events.setState('teardownTest');
- events.setTest(module.__teardownTest__);
- this.wrapper(module.__teardownTest__, test);
- events.endTest(module.__teardownTest__);
- }
- events.endTest(test)
- }
- observer.unregister();
- } else {
- for each(var test in module.__tests__) {
- events.setTest(test);
- events.skip("setupModule failed.");
- events.endTest(test);
- }
- }
- if (module.__teardownModule__) {
- events.setState('teardownModule');
- events.setTest(module.__teardownModule__);
- this.wrapper(module.__teardownModule__, module);
- events.endTest(module.__teardownModule__);
- }
- module.__status__ = 'done';
-}
-Runner.prototype.runTestModule = function (module) {
- if (module.__requirements__ != undefined && module.__force_skip__ == undefined) {
- if (!arrays.inArray(this.collector.loaded_directories, module.__root_path__)) {
- if (module.__root_path__ != undefined) {
- this.collector.initTestDirectory(module.__root_path__);
- }
- }
- var deps = this.getDependencies(module);
- for (var i in deps) {
- var dep = deps[i];
- if (dep.status != 'done') {
- this._runTestModule(dep);
- }
- }
- }
- this._runTestModule(module);
-}
-
-
-var runTestDirectory = function (dir, invokedFromIDE) {
- var runner = new Runner(new Collector(), invokedFromIDE);
- runner.runTestDirectory(dir);
- runner.end();
- return true;
-}
-var runTestFile = function (filename, invokedFromIDE) {
- var runner = new Runner(new Collector(), invokedFromIDE);
- runner.runTestFile(filename);
- runner.end();
- return true;
-}
-
-var getThread = function () {
- return thread;
-}
deleted file mode 100644
--- a/mail/test/resources/mozmill/mozmill/extension/resource/modules/init.js
+++ /dev/null
@@ -1,136 +0,0 @@
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Mozilla Corporation Code.
- *
- * The Initial Developer of the Original Code is
- * Adam Christian.
- * Portions created by the Initial Developer are Copyright (C) 2008
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- * Adam Christian <adam.christian@gmail.com>
- * Mikeal Rogers <mikeal.rogers@gmail.com>
- * Henrik Skupin <hskupin@mozilla.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-var EXPORTED_SYMBOLS = ["mozmill"];
-
-const Cc = Components.classes;
-const Ci = Components.interfaces;
-const Cu = Components.utils;
-
-var mozmill = Cu.import('resource://mozmill/modules/mozmill.js');
-
-// Observer for new top level windows
-var windowObserver = {
- observe: function(subject, topic, data) {
- attachEventListeners(subject);
- }
-};
-
-/**
- * Attach event listeners
- */
-function attachEventListeners(window) {
- window.addEventListener("load", function (event) {
- window.mozmillDocumentLoaded = true;
-
- if (window.gBrowser) {
- // Page is ready
- window.gBrowser.addEventListener("load", function (event) {
- // this is the content document of the loaded page.
- var doc = event.originalTarget;
- var tab = window.gBrowser.getBrowserForDocument(doc);
-
- if (tab) {
- //dump("*** Loaded tab: location=" + doc.location + ", baseURI=" + doc.baseURI + "\n");
- tab.mozmillDocumentLoaded = true;
- } else {
- //dump("*** Loaded HTML location=" + doc.location + ", baseURI=" + doc.baseURI + "\n");
- doc.defaultView.mozmillDocumentLoaded = true;
- }
- }, true);
-
- // Note: Error pages will never fire a "load" event. For those we
- // have to wait for the "DOMContentLoaded" event. That's the final state.
- // Error pages will always have a baseURI starting with
- // "about:" followed by "error" or "blocked".
- window.gBrowser.addEventListener("DOMContentLoaded", function (event) {
- var errorRegex = /about:.+(error)|(blocked)\?/;
- if (errorRegex.exec(event.target.baseURI)) {
- // Wait about 1s to be sure the DOM is ready
- mozmill.utils.sleep(1000);
-
- var tab = window.gBrowser.getBrowserForDocument(event.target);
- if (tab)
- tab.mozmillDocumentLoaded = true;
- }
- }, true);
-
- // Page is about to get unloaded
- window.gBrowser.addEventListener("beforeunload", function (event) {
- var doc = event.originalTarget;
- var tab = window.gBrowser.getBrowserForDocument(event.target);
-
- if (tab) {
- //dump("*** Unload tab: location=" + doc.location + ", baseURI=" + doc.baseURI + "\n");
- tab.mozmillDocumentLoaded = false;
- } else {
- //dump("*** Unload HTML location=" + doc.location + ", baseURI=" + doc.baseURI + "\n");
- doc.defaultView.mozmillDocumentLoaded = false;
- }
-
- }, true);
- }
- }, false);
-}
-
-/**
- * Initialize Mozmill
- */
-function initialize() {
- // Activate observer for new top level windows
- var observerService = Cc["@mozilla.org/observer-service;1"].
- getService(Ci.nsIObserverService);
- observerService.addObserver(windowObserver, "toplevel-window-ready", false);
-
- // Attach event listeners to all open windows
- var enumerator = Cc["@mozilla.org/appshell/window-mediator;1"].
- getService(Ci.nsIWindowMediator).getEnumerator("");
- while (enumerator.hasMoreElements()) {
- var win = enumerator.getNext();
- attachEventListeners(win);
-
- // For windows or dialogs already open we have to explicitly set the property
- // otherwise windows which load really quick never gets the property set and
- // we fail to create the controller
- win.mozmillDocumentLoaded = true;
- };
-}
-
-initialize();
-
deleted file mode 100644
--- a/mail/test/resources/mozmill/mozmill/extension/resource/modules/inspection.js
+++ /dev/null
@@ -1,396 +0,0 @@
-// ***** BEGIN LICENSE BLOCK *****
-// Version: MPL 1.1/GPL 2.0/LGPL 2.1
-//
-// The contents of this file are subject to the Mozilla Public License Version
-// 1.1 (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-// http://www.mozilla.org/MPL/
-//
-// Software distributed under the License is distributed on an "AS IS" basis,
-// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-// for the specific language governing rights and limitations under the
-// License.
-//
-// The Original Code is Mozilla Corporation Code.
-//
-// The Initial Developer of the Original Code is
-// Mikeal Rogers.
-// Portions created by the Initial Developer are Copyright (C) 2008
-// the Initial Developer. All Rights Reserved.
-//
-// Contributor(s):
-// Mikeal Rogers <mikeal.rogers@gmail.com>
-//
-// Alternatively, the contents of this file may be used under the terms of
-// either the GNU General Public License Version 2 or later (the "GPL"), or
-// the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-// in which case the provisions of the GPL or the LGPL are applicable instead
-// of those above. If you wish to allow use of your version of this file only
-// under the terms of either the GPL or the LGPL, and not to allow others to
-// use your version of this file under the terms of the MPL, indicate your
-// decision by deleting the provisions above and replace them with the notice
-// and other provisions required by the GPL or the LGPL. If you do not delete
-// the provisions above, a recipient may use your version of this file under
-// the terms of any one of the MPL, the GPL or the LGPL.
-//
-// ***** END LICENSE BLOCK *****
-
-var EXPORTED_SYMBOLS = ["inspectElement"]
-
-var elementslib = {}; Components.utils.import('resource://mozmill/modules/elementslib.js', elementslib);
-var mozmill = {}; Components.utils.import('resource://mozmill/modules/mozmill.js', mozmill);
-var utils = {}; Components.utils.import('resource://mozmill/modules/utils.js', utils);
-
-var arrays = {}; Components.utils.import('resource://mozmill/stdlib/arrays.js', arrays);
-var dom = {}; Components.utils.import('resource://mozmill/stdlib/dom.js', dom);
-var objects = {}; Components.utils.import('resource://mozmill/stdlib/objects.js', objects);
-var json2 = {}; Components.utils.import('resource://mozmill/stdlib/json2.js', json2);
-var withs = {}; Components.utils.import('resource://mozmill/stdlib/withs.js', withs);
-
-var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
- .getService(Components.interfaces.nsIWindowMediator);
-
-var isNotAnonymous = function (elem, result) {
- if (result == undefined) {
- var result = true;
- }
- if ( elem.parentNode ) {
- var p = elem.parentNode;
- return isNotAnonymous(p, result == arrays.inArray(p.childNodes, elem) == true);
- } else {
- return result;
- }
-}
-
-var elemIsAnonymous = function (elem) {
- if (elem.getAttribute('anonid') || !arrays.inArray(elem.parentNode.childNodes, elem)) {
- return true;
- }
- return false;
-}
-
-var getXPath = function (node, path) {
- path = path || [];
-
- if(node.parentNode) {
- path = getXPath(node.parentNode, path);
- }
-
- if(node.previousSibling) {
- var count = 1;
- var sibling = node.previousSibling
- do {
- if(sibling.nodeType == 1 && sibling.nodeName == node.nodeName) {count++;}
- sibling = sibling.previousSibling;
- } while(sibling);
- if(count == 1) {count = null;}
- } else if(node.nextSibling) {
- var sibling = node.nextSibling;
- do {
- if(sibling.nodeType == 1 && sibling.nodeName == node.nodeName) {
- var count = 1;
- sibling = null;
- } else {
- var count = null;
- sibling = sibling.previousSibling;
- }
- } while(sibling);
- }
-
- if(node.nodeType == 1) {
- // if ($('absXpaths').checked){
- path.push(node.nodeName.toLowerCase() + (node.id ? "[@id='"+node.id+"']" : count > 0 ? "["+count+"]" : ''));
- // }
- // else{
- // path.push(node.nodeName.toLowerCase() + (node.id ? "" : count > 0 ? "["+count+"]" : ''));
- // }
- }
- return path;
-};
-
-function getXSPath(node){
- var xpArray = getXPath(node);
- var stringXpath = xpArray.join('/');
- stringXpath = '/'+stringXpath;
- stringXpath = stringXpath.replace('//','/');
- return stringXpath;
-}
-function getXULXpath (el, xml) {
- var xpath = '';
- var pos, tempitem2;
-
- while(el !== xml.documentElement) {
- pos = 0;
- tempitem2 = el;
- while(tempitem2) {
- if (tempitem2.nodeType === 1 && tempitem2.nodeName === el.nodeName) {
- // If it is ELEMENT_NODE of the same name
- pos += 1;
- }
- tempitem2 = tempitem2.previousSibling;
- }
-
- xpath = "*[name()='"+el.nodeName+"' and namespace-uri()='"+(el.namespaceURI===null?'':el.namespaceURI)+"']["+pos+']'+'/'+xpath;
-
- el = el.parentNode;
- }
- xpath = '/*'+"[name()='"+xml.documentElement.nodeName+"' and namespace-uri()='"+(el.namespaceURI===null?'':el.namespaceURI)+"']"+'/'+xpath;
- xpath = xpath.replace(/\/$/, '');
- return xpath;
-}
-
-var getDocument = function (elem) {
- while (elem.parentNode) {
- var elem = elem.parentNode;
- }
- return elem;
-}
-
-var getTopWindow = function(doc) {
- return utils.getChromeWindow(doc.defaultView);
-}
-
-var attributeToIgnore = ['focus', 'focused', 'selected', 'select', 'flex', // General Omissions
- 'linkedpanel', 'last-tab', 'afterselected', // From Tabs UI, thanks Farhad
- 'style', // Gets set dynamically all the time, also effected by dx display code
- ];
-
-var getUniqueAttributesReduction = function (attributes, node) {
- for (var i in attributes) {
- if ( node.getAttribute(i) == attributes[i] || arrays.inArray(attributeToIgnore, i) || arrays.inArray(attributeToIgnore, attributes[i]) || i == 'id') {
- delete attributes[i];
- }
- }
- return attributes;
-}
-
-var getLookupExpression = function (_document, elem) {
- expArray = [];
- while ( elem.parentNode ) {
- var exp = getLookupForElem(_document, elem);
- expArray.push(exp);
- var elem = elem.parentNode;
- }
- expArray.reverse();
- return '/' + expArray.join('/');
-}
-
-var getLookupForElem = function (_document, elem) {
- if ( !elemIsAnonymous(elem) ) {
- if (elem.id != "" && !withs.startsWith(elem.id, 'panel')) {
- identifier = {'name':'id', 'value':elem.id};
- } else if ((elem.name != "") && (typeof(elem.name) != "undefined")) {
- identifier = {'name':'name', 'value':elem.name};
- } else {
- identifier = null;
- }
-
- if (identifier) {
- var result = {'id':elementslib._byID, 'name':elementslib._byName}[identifier.name](_document, elem.parentNode, identifier.value);
- if ( typeof(result != 'array') ) {
- return identifier.name+'('+json2.JSON.stringify(identifier.value)+')';
- }
- }
-
- // At this point there is either no identifier or it returns multiple
- var parse = [n for each (n in elem.parentNode.childNodes) if
- (n.getAttribute && n != elem)
- ];
- parse.unshift(dom.getAttributes(elem));
- var uniqueAttributes = parse.reduce(getUniqueAttributesReduction);
-
- if (!result) {
- var result = elementslib._byAttrib(elem.parentNode, uniqueAttributes);
- }
-
- if (!identifier && typeof(result) == 'array' ) {
- return json2.JSON.stringify(uniqueAttributes) + '['+arrays.indexOf(result, elem)+']'
- } else {
- var aresult = elementslib._byAttrib(elem.parentNode, uniqueAttributes);
- if ( typeof(aresult != 'array') ) {
- if (objects.getLength(uniqueAttributes) == 0) {
- return '['+arrays.indexOf(elem.parentNode.childNodes, elem)+']'
- }
- return json2.JSON.stringify(uniqueAttributes)
- } else if ( result.length > aresult.length ) {
- return json2.JSON.stringify(uniqueAttributes) + '['+arrays.indexOf(aresult, elem)+']'
- } else {
- return identifier.name+'('+json2.JSON.stringify(identifier.value)+')' + '['+arrays.indexOf(result, elem)+']'
- }
- }
-
- } else {
- // Handle Anonymous Nodes
- var parse = [n for each (n in _document.getAnonymousNodes(elem.parentNode)) if
- (n.getAttribute && n != elem)
- ];
- parse.unshift(dom.getAttributes(elem));
- var uniqueAttributes = parse.reduce(getUniqueAttributesReduction);
- if (uniqueAttributes.anonid && typeof(elementslib._byAnonAttrib(_document,
- elem.parentNode, {'anonid':uniqueAttributes.anonid})) != 'array') {
- uniqueAttributes = {'anonid':uniqueAttributes.anonid};
- }
-
- if (objects.getLength(uniqueAttributes) == 0) {
- return 'anon(['+arrays.indexOf(_document.getAnonymousNodes(elem.parentNode), elem)+'])';
- } else if (arrays.inArray(uniqueAttributes, 'anonid')) {
- return 'anon({"anonid":"'+uniqueAttributes['anonid']+'"})';
- } else {
- return 'anon('+json2.JSON.stringify(uniqueAttributes)+')';
- }
-
- }
- return 'broken '+elemIsAnonymous(elem)
-}
-
-var removeHTMLTags = function(str){
- str = str.replace(/&(lt|gt);/g, function (strMatch, p1){
- return (p1 == "lt")? "<" : ">";
- });
- var strTagStrippedText = str.replace(/<\/?[^>]+(>|$)/g, "");
- strTagStrippedText = strTagStrippedText.replace(/ /g,"");
- return strTagStrippedText;
-}
-
-var isMagicAnonymousDiv = function (_document, node) {
- if (node.getAttribute && node.getAttribute('class') == 'anonymous-div') {
- if (!arrays.inArray(node.parentNode.childNodes, node) && (_document.getAnonymousNodes(node) == null ||
- !arrays.inArray(_document.getAnonymousNodes(node), node) ) ) {
- return true;
- }
- }
- return false;
-}
-
-var copyToClipboard = function(str){
- const gClipboardHelper = Components.classes["@mozilla.org/widget/clipboardhelper;1"] .getService(Components.interfaces.nsIClipboardHelper);
- gClipboardHelper.copyString(str);
-}
-
-var getControllerAndDocument = function (_document, _window) {
- var windowtype = _window.document.documentElement.getAttribute('windowtype');
- var controllerString, documentString, activeTab;
-
- // TODO replace with object based cases
- switch(windowtype) {
- case 'navigator:browser':
- controllerString = 'mozmill.getBrowserController()';
- activeTab = mozmill.getBrowserController().tabs.activeTab;
- break;
- case 'Browser:Preferences':
- controllerString = 'mozmill.getPreferencesController()';
- break;
- case 'Extension:Manager':
- controllerString = 'mozmill.getAddonsController()';
- break;
- default:
- if(windowtype)
- controllerString = 'new mozmill.controller.MozMillController(mozmill.utils.getWindowByType("' + windowtype + '"))';
- else if(_window.document.title)
- controllerString = 'new mozmill.controller.MozMillController(mozmill.utils.getWindowByTitle("'+_window.document.title+'"))';
- else
- controllerString = 'Cannot find window';
- break;
- }
-
- if(activeTab == _document) {
- documentString = 'controller.tabs.activeTab';
- } else if(activeTab == _document.defaultView.top.document) {
- // if this document is from an iframe in the active tab
- var stub = getDocumentStub(_document, activeTab.defaultView);
- documentString = 'controller.tabs.activeTab.defaultView' + stub;
- } else {
- var stub = getDocumentStub(_document, _window);
- if(stub)
- documentString = 'controller.window' + stub;
- else
- documentString = 'Cannot find document';
- }
- return {'controllerString':controllerString, 'documentString':documentString}
-}
-
-getDocumentStub = function( _document, _window) {
- if(_window.document == _document)
- return '.document';
- for(var i = 0; i < _window.frames.length; i++) {
- var stub = getDocumentStub(_document, _window.frames[i]);
- if (stub)
- return '.frames['+i+']' + stub;
- }
- return '';
-}
-
-var inspectElement = function(e){
- if (e.originalTarget != undefined) {
- target = e.originalTarget;
- } else {
- target = e.target;
- }
-
- //Element highlighting
- try {
- if (this.lastEvent)
- this.lastEvent.target.style.outline = "";
- } catch(err) {}
-
- this.lastEvent = e;
-
- try {
- e.target.style.outline = "1px solid darkblue";
- } catch(err){}
-
- var _document = getDocument(target);
-
-
- if (isMagicAnonymousDiv(_document, target)) {
- target = target.parentNode;
- }
-
- var windowtype = _document.documentElement.getAttribute('windowtype');
- var _window = getTopWindow(_document);
- r = getControllerAndDocument(_document, _window);
-
- // displayText = "Controller: " + r.controllerString + '\n\n';
- if ( isNotAnonymous(target) ) {
- // Logic for which identifier to use is duplicated above
- if (target.id != "" && !withs.startsWith(target.id, 'panel')) {
- elemText = "new elementslib.ID("+ r.documentString + ', "' + target.id + '")';
- var telem = new elementslib.ID(_document, target.id);
- } else if ((target.name != "") && (typeof(target.name) != "undefined")) {
- elemText = "new elementslib.Name("+ r.documentString + ', "' + target.name + '")';
- var telem = new elementslib.Name(_document, target.name);
- } else if (target.nodeName == "A") {
- var linkText = removeHTMLTags(target.innerHTML);
- elemText = "new elementslib.Link("+ r.documentString + ', "' + linkText + '")';
- var telem = new elementslib.Link(_document, linkText);
- }
- }
- // Fallback on XPath
- if (telem == undefined || telem.getNode() != target) {
- if (windowtype == null) {
- var stringXpath = getXSPath(target);
- } else {
- var stringXpath = getXULXpath(target, _document);
- }
- var telem = new elementslib.XPath(_document, stringXpath);
- if ( telem.getNode() == target ) {
- elemText = "new elementslib.XPath("+ r.documentString + ', "' + stringXpath + '")';
- }
- }
- // Fallback to Lookup
- if (telem == undefined || telem.getNode() != target) {
- var exp = getLookupExpression(_document, target);
- elemText = "new elementslib.Lookup("+ r.documentString + ", '" + exp + "')";
- var telem = new elementslib.Lookup(_document, exp);
- }
-
- return {'validation':( target == telem.getNode() ),
- 'elementText':elemText,
- 'elementType':telem.constructor.name,
- 'controllerText':r.controllerString,
- 'documentString':r.documentString,
- }
-}
-
-
-
deleted file mode 100644
--- a/mail/test/resources/mozmill/mozmill/extension/resource/modules/jum.js
+++ /dev/null
@@ -1,193 +0,0 @@
-// ***** BEGIN LICENSE BLOCK *****
-// Version: MPL 1.1/GPL 2.0/LGPL 2.1
-//
-// The contents of this file are subject to the Mozilla Public License Version
-// 1.1 (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-// http://www.mozilla.org/MPL/
-//
-// Software distributed under the License is distributed on an "AS IS" basis,
-// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-// for the specific language governing rights and limitations under the
-// License.
-//
-// The Original Code is Mozilla Corporation Code.
-//
-// The Initial Developer of the Original Code is
-// Adam Christian.
-// Portions created by the Initial Developer are Copyright (C) 2008
-// the Initial Developer. All Rights Reserved.
-//
-// Contributor(s):
-// Mikeal Rogers <mikeal.rogers@gmail.com>
-//
-// Alternatively, the contents of this file may be used under the terms of
-// either the GNU General Public License Version 2 or later (the "GPL"), or
-// the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-// in which case the provisions of the GPL or the LGPL are applicable instead
-// of those above. If you wish to allow use of your version of this file only
-// under the terms of either the GPL or the LGPL, and not to allow others to
-// use your version of this file under the terms of the MPL, indicate your
-// decision by deleting the provisions above and replace them with the notice
-// and other provisions required by the GPL or the LGPL. If you do not delete
-// the provisions above, a recipient may use your version of this file under
-// the terms of any one of the MPL, the GPL or the LGPL.
-//
-// ***** END LICENSE BLOCK *****
-
-var EXPORTED_SYMBOLS = ["assert", "assertTrue", "assertFalse", "assertEquals", "assertNotEquals",
- "assertNull", "assertNotNull", "assertUndefined", "assertNotUndefined",
- "assertNaN", "assertNotNaN", "fail", "pass"];
-
-var frame = {}; Components.utils.import("resource://mozmill/modules/frame.js", frame);
-
-var ifJSONable = function (v) {
- if (typeof(v) == 'function') {
- return undefined;
- } else {
- return v;
- }
-}
-
-var assert = function (booleanValue, comment) {
- if (booleanValue) {
- frame.events.pass({'function':'jum.assert', 'value':ifJSONable(booleanValue), 'comment':comment});
- return true;
- }
- reportFail("jum.assert(" + ifJSONable(booleanValue) + ") - " + comment);
- return false;
-}
-
-var assertTrue = function (booleanValue, comment) {
- if (typeof(booleanValue) != 'boolean') {
- reportFail("jum.assertTrue(" + ifJSONable(booleanValue) + ") " +
- "Bad argument, value type " + typeof(booleanValue) + " isn't boolean - " + comment);
- return false;
- }
-
- if (booleanValue) {
- frame.events.pass({'function':'jum.assertTrue', 'value':ifJSONable(booleanValue),
- 'comment':comment});
- return true;
- }
- reportFail("jum.assertTrue(" + ifJSONable(booleanValue) + ") - " + comment);
- return false;
-}
-
-var assertFalse = function (booleanValue, comment) {
- if (typeof(booleanValue) != 'boolean') {
- reportFail("jum.assertFalse(" + ifJSONable(booleanValue) + ") " +
- "Bad argument, value type " + typeof(booleanValue) + " isn't boolean - " + comment);
- return false;
- }
-
- if (!booleanValue) {
- frame.events.pass({'function':'jum.assertFalse', 'value':ifJSONable(booleanValue),
- 'comment':comment});
- return true;
- }
- reportFail("jum.assertFalse(" + ifJSONable(booleanValue) + ") - " + comment);
- return false;
-}
-
-var assertEquals = function (value1, value2, comment) {
- if (value1 == value2) {
- frame.events.pass({'function':'jum.assertEquals', 'comment':comment,
- 'value1':ifJSONable(value1), 'value2':ifJSONable(value2)});
- return true;
- }
- reportFail("jum.assertEquals(" + ifJSONable(value1) + ", " +
- ifJSONable(value2) + ") - " + comment);
- return false;
-}
-
-var assertNotEquals = function (value1, value2, comment) {
- if (value1 != value2) {
- frame.events.pass({'function':'jum.assertNotEquals', 'comment':comment,
- 'value1':ifJSONable(value1), 'value2':ifJSONable(value2)});
- return true;
- }
- reportFail("jum.assertNotEquals(" + ifJSONable(value1) + ", " +
- ifJSONable(value2) + ") - " + comment);
- return false;
-}
-
-var assertNull = function (value, comment) {
- if (value == null) {
- frame.events.pass({'function':'jum.assertNull', 'comment':comment,
- 'value':ifJSONable(value)});
- return true;
- }
- reportFail("jum.assertNull(" + ifJSONable(booleanValue) + ") - " + comment);
- return false;
-}
-
-var assertNotNull = function (value, comment) {
- if (value != null) {
- frame.events.pass({'function':'jum.assertNotNull', 'comment':comment,
- 'value':ifJSONable(value)});
- return true;
- }
- reportFail("jum.assertNotNull(" + ifJSONable(booleanValue) + ") - " + comment);
- return false;
-}
-
-var assertUndefined = function (value, comment) {
- if (value == undefined) {
- frame.events.pass({'function':'jum.assertUndefined', 'comment':comment,
- 'value':ifJSONable(value)});
- return true;
- }
- reportFail("jum.assertUndefined(" + ifJSONable(booleanValue) + ") - " + comment);
- return false;
-}
-
-var assertNotUndefined = function (value, comment) {
- if (value != undefined) {
- frame.events.pass({'function':'jum.assertNotUndefined', 'comment':comment,
- 'value':ifJSONable(value)});
- return true;
- }
- reportFail("jum.assertNotUndefined(" + ifJSONable(booleanValue) + ") - " + comment);
- return false;
-}
-
-var assertNaN = function (value, comment) {
- if (isNaN(value)) {
- frame.events.pass({'function':'jum.assertNaN', 'comment':comment,
- 'value':ifJSONable(value)});
- return true;
- }
- reportFail("jum.assertNaN(" + ifJSONable(booleanValue) + ") - " + comment);
- return false;
-}
-
-var assertNotNaN = function (value, comment) {
- if (!isNaN(value)) {
- frame.events.pass({'function':'jum.assertNotNaN', 'comment':comment,
- 'value':ifJSONable(value)});
- return true;
- }
- reportFail("jum.assertNotNaN(" + ifJSONable(booleanValue) + ") - " + comment);
- return false;
-}
-
-var reportFail = function(comment) {
- try {
- throw new Error(comment || "");
- } catch(e) {
- frame.events.fail({'assertion': e});
- }
-}
-
-var fail = function (comment) {
- frame.events.fail({'function':'jum.fail', 'comment':comment});
- return false;
-}
-
-var pass = function (comment) {
- frame.events.pass({'function':'jum.pass', 'comment':comment});
- return true;
-}
-
-
deleted file mode 100644
--- a/mail/test/resources/mozmill/mozmill/extension/resource/modules/mozmill.js
+++ /dev/null
@@ -1,216 +0,0 @@
-// ***** BEGIN LICENSE BLOCK *****
-// Version: MPL 1.1/GPL 2.0/LGPL 2.1
-//
-// The contents of this file are subject to the Mozilla Public License Version
-// 1.1 (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-// http://www.mozilla.org/MPL/
-//
-// Software distributed under the License is distributed on an "AS IS" basis,
-// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-// for the specific language governing rights and limitations under the
-// License.
-//
-// The Original Code is Mozilla Corporation Code.
-//
-// The Initial Developer of the Original Code is
-// Mikeal Rogers.
-// Portions created by the Initial Developer are Copyright (C) 2008
-// the Initial Developer. All Rights Reserved.
-//
-// Contributor(s):
-// Mikeal Rogers <mikeal.rogers@gmail.com>
-// Gary Kwong <nth10sd@gmail.com>
-//
-// Alternatively, the contents of this file may be used under the terms of
-// either the GNU General Public License Version 2 or later (the "GPL"), or
-// the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-// in which case the provisions of the GPL or the LGPL are applicable instead
-// of those above. If you wish to allow use of your version of this file only
-// under the terms of either the GPL or the LGPL, and not to allow others to
-// use your version of this file under the terms of the MPL, indicate your
-// decision by deleting the provisions above and replace them with the notice
-// and other provisions required by the GPL or the LGPL. If you do not delete
-// the provisions above, a recipient may use your version of this file under
-// the terms of any one of the MPL, the GPL or the LGPL.
-//
-// ***** END LICENSE BLOCK *****
-
-var EXPORTED_SYMBOLS = ["controller", "events", "utils", "elementslib", "os",
- "getBrowserController", "newBrowserController",
- "getAddonsController", "getPreferencesController",
- "newMail3PaneController", "getMail3PaneController",
- "wm", "platform", "getAddrbkController",
- "getMsgComposeController", "getDownloadsController",
- "Application", "MozMillAsyncTest", "cleanQuit",
- "getPlacesController", 'isMac', 'isLinux', 'isWindows',
- ];
-
-var controller = {}; Components.utils.import('resource://mozmill/modules/controller.js', controller);
-var events = {}; Components.utils.import('resource://mozmill/modules/events.js', events);
-var utils = {}; Components.utils.import('resource://mozmill/modules/utils.js', utils);
-var elementslib = {}; Components.utils.import('resource://mozmill/modules/elementslib.js', elementslib);
-var frame = {}; Components.utils.import('resource://mozmill/modules/frame.js', frame);
-
-var os = {}; Components.utils.import('resource://mozmill/stdlib/os.js', os);
-var withs = {}; Components.utils.import('resource://mozmill/stdlib/withs.js', withs);
-
-var platform = os.getPlatform();
-
-var isMac = false;
-var isWindows = false;
-var isLinux = false;
-
-if (platform == "darwin"){
- isMac = true;
-}
-if (platform == "winnt"){
- isWindows = true;
-}
-if (platform == "linux"){
- isLinux = true;
-}
-
-var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
- .getService(Components.interfaces.nsIWindowMediator);
-
-var appInfo = Components.classes["@mozilla.org/xre/app-info;1"]
- .getService(Components.interfaces.nsIXULAppInfo);
-
-var locale = Components.classes["@mozilla.org/chrome/chrome-registry;1"]
- .getService(Components.interfaces.nsIXULChromeRegistry)
- .getSelectedLocale("global");
-
-var aConsoleService = Components.classes["@mozilla.org/consoleservice;1"].
- getService(Components.interfaces.nsIConsoleService);
-
-
-applicationDictionary = {
- "{718e30fb-e89b-41dd-9da7-e25a45638b28}": "Sunbird",
- "{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}": "SeaMonkey",
- "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}": "Firefox",
- "{3550f703-e582-4d05-9a08-453d09bdfdc6}": 'Thunderbird',
-}
-
-var Application = applicationDictionary[appInfo.ID];
-
-if (Application == undefined) {
- // Default to Firefox
- var Application = 'Firefox';
-}
-
-function cleanQuit () {
- utils.getMethodInWindows('goQuitApplication')();
-}
-
-function addHttpResource (directory, namespace) {
- return 'http://localhost:4545/'+namespace;
-}
-
-function newBrowserController () {
- return new controller.MozMillController(utils.getMethodInWindows('OpenBrowserWindow')());
-}
-
-function getBrowserController () {
- var browserWindow = wm.getMostRecentWindow("navigator:browser");
- if (browserWindow == null) {
- return newBrowserController();
- }
- else {
- return new controller.MozMillController(browserWindow);
- }
-}
-
-function getPlacesController () {
- utils.getMethodInWindows('PlacesCommandHook').showPlacesOrganizer('AllBookmarks');
- return new controller.MozMillController(wm.getMostRecentWindow(''));
-}
-
-function getAddonsController () {
- if (Application == 'SeaMonkey') {
- utils.getMethodInWindows('toEM')();
- } else if (Application == 'Thunderbird') {
- utils.getMethodInWindows('openAddonsMgr')();
- } else if (Application == 'Sunbird') {
- utils.getMethodInWindows('goOpenAddons')();
- } else {
- utils.getMethodInWindows('BrowserOpenAddonsMgr')();
- }
- return new controller.MozMillController(wm.getMostRecentWindow(''));
-}
-
-function getDownloadsController() {
- utils.getMethodInWindows('BrowserDownloadsUI')();
- return new controller.MozMillController(wm.getMostRecentWindow(''));
-}
-
-function getPreferencesController() {
- if (Application == 'Thunderbird') {
- utils.getMethodInWindows('openOptionsDialog')();
- } else {
- utils.getMethodInWindows('openPreferences')();
- }
- // utils.sleep(1000)
- return new controller.MozMillController(wm.getMostRecentWindow(''));
-}
-
-// Thunderbird functions
-function newMail3PaneController () {
- return new controller.MozMillController(utils.getMethodInWindows('toMessengerWindow')());
-}
-
-function getMail3PaneController () {
- var mail3PaneWindow = wm.getMostRecentWindow("mail:3pane");
- if (mail3PaneWindow == null) {
- return newMail3PaneController();
- }
- else {
- return new controller.MozMillController(mail3PaneWindow);
- }
-}
-
-// Thunderbird - Address book window
-function newAddrbkController () {
- utils.getMethodInWindows("toAddressBook")();
- utils.sleep(2000);
- var addyWin = wm.getMostRecentWindow("mail:addressbook");
- return new controller.MozMillController(addyWin);
-}
-
-function getAddrbkController () {
- var addrbkWindow = wm.getMostRecentWindow("mail:addressbook");
- if (addrbkWindow == null) {
- return newAddrbkController();
- }
- else {
- return new controller.MozMillController(addrbkWindow);
- }
-}
-
-MozMillAsyncTest = controller.MozMillAsyncTest;
-
-function firePythonCallback (method, obj) {
- frame.events.fireEvent("firePythonCallback", {"method":method, "arg":obj, "fire_now":true, "filename":frame.events.currentModule.__file__});
-}
-function firePythonCallbackAfterRestart(method, obj) {
- frame.events.fireEvent("firePythonCallback", {"method":method, "arg":obj, "fire_now":false, "filename":frame.events.currentModule.__file__});
-}
-
-function timer (name) {
- this.name = name;
- this.timers = {};
- frame.timers.push(this);
- this.actions = [];
-}
-timer.prototype.start = function (name) {
- this.timers[name].startTime = (new Date).getTime();
-}
-timer.prototype.stop = function (name) {
- var t = this.timers[name];
- t.endTime = (new Date).getTime();
- t.totalTime = (t.endTime - t.startTime);
-}
-timer.prototype.end = function () {
- frame.events.fireEvent("timer", this);
- frame.timers.remove(this);
-}
deleted file mode 100644
--- a/mail/test/resources/mozmill/mozmill/extension/resource/modules/utils.js
+++ /dev/null
@@ -1,543 +0,0 @@
-// ***** BEGIN LICENSE BLOCK *****
-// Version: MPL 1.1/GPL 2.0/LGPL 2.1
-//
-// The contents of this file are subject to the Mozilla Public License Version
-// 1.1 (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-// http://www.mozilla.org/MPL/
-//
-// Software distributed under the License is distributed on an "AS IS" basis,
-// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-// for the specific language governing rights and limitations under the
-// License.
-//
-// The Original Code is Mozilla Corporation Code.
-//
-// The Initial Developer of the Original Code is
-// Adam Christian.
-// Portions created by the Initial Developer are Copyright (C) 2008
-// the Initial Developer. All Rights Reserved.
-//
-// Contributor(s):
-// Adam Christian <adam.christian@gmail.com>
-// Mikeal Rogers <mikeal.rogers@gmail.com>
-// Henrik Skupin <hskupin@mozilla.com>
-//
-// Alternatively, the contents of this file may be used under the terms of
-// either the GNU General Public License Version 2 or later (the "GPL"), or
-// the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-// in which case the provisions of the GPL or the LGPL are applicable instead
-// of those above. If you wish to allow use of your version of this file only
-// under the terms of either the GPL or the LGPL, and not to allow others to
-// use your version of this file under the terms of the MPL, indicate your
-// decision by deleting the provisions above and replace them with the notice
-// and other provisions required by the GPL or the LGPL. If you do not delete
-// the provisions above, a recipient may use your version of this file under
-// the terms of any one of the MPL, the GPL or the LGPL.
-//
-// ***** END LICENSE BLOCK *****
-
-var EXPORTED_SYMBOLS = ["openFile", "saveFile", "saveAsFile", "genBoiler",
- "getFile", "Copy", "getChromeWindow", "getWindows", "runEditor",
- "runFile", "getWindowByTitle", "getWindowByType", "tempfile",
- "getMethodInWindows", "getPreference", "setPreference",
- "sleep", "assert", "unwrapNode", "TimeoutError", "waitFor", "waitForEval"];
-
-var hwindow = Components.classes["@mozilla.org/appshell/appShellService;1"]
- .getService(Components.interfaces.nsIAppShellService)
- .hiddenDOMWindow;
-
-var uuidgen = Components.classes["@mozilla.org/uuid-generator;1"]
- .getService(Components.interfaces.nsIUUIDGenerator);
-
-function Copy (obj) {
- for (var n in obj) {
- this[n] = obj[n];
- }
-}
-
-function getChromeWindow(aWindow) {
- var chromeWin = aWindow
- .QueryInterface(Components.interfaces.nsIInterfaceRequestor)
- .getInterface(Components.interfaces.nsIWebNavigation)
- .QueryInterface(Components.interfaces.nsIDocShellTreeItem)
- .rootTreeItem
- .QueryInterface(Components.interfaces.nsIInterfaceRequestor)
- .getInterface(Components.interfaces.nsIDOMWindow)
- .QueryInterface(Components.interfaces.nsIDOMChromeWindow);
- return chromeWin;
-}
-
-function getWindows(type) {
- if (type == undefined) {
- type = "";
- }
- var windows = []
- var enumerator = Components.classes["@mozilla.org/appshell/window-mediator;1"]
- .getService(Components.interfaces.nsIWindowMediator)
- .getEnumerator(type);
- while(enumerator.hasMoreElements()) {
- windows.push(enumerator.getNext());
- }
- if (type == "") {
- windows.push(hwindow);
- }
- return windows;
-}
-
-function getMethodInWindows (methodName) {
- for each(w in getWindows()) {
- if (w[methodName] != undefined) {
- return w[methodName];
- }
- }
- throw new Error("Method with name: '" + methodName + "' is not in any open window.");
-}
-
-function getWindowByTitle(title) {
- for each(w in getWindows()) {
- if (w.document.title && w.document.title == title) {
- return w;
- }
- }
-}
-
-function getWindowByType(type) {
- var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
- .getService(Components.interfaces.nsIWindowMediator);
- return wm.getMostRecentWindow(type);
-}
-
-function tempfile(appention) {
- if (appention == undefined) {
- var appention = "mozmill.utils.tempfile"
- }
- var tempfile = Components.classes["@mozilla.org/file/directory_service;1"].getService(Components.interfaces.nsIProperties).get("TmpD", Components.interfaces.nsIFile);
- tempfile.append(uuidgen.generateUUID().toString().replace('-', '').replace('{', '').replace('}',''))
- tempfile.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0777);
- tempfile.append(appention);
- tempfile.createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, 0666);
- // do whatever you need to the created file
- return tempfile.clone()
-}
-
-var checkChrome = function() {
- var loc = window.document.location.href;
- try {
- loc = window.top.document.location.href;
- } catch (e) {}
-
- if (/^chrome:\/\//.test(loc)) { return true; }
- else { return false; }
-}
-
-/*var openFile = function(){
- const nsIFilePicker = Components.interfaces.nsIFilePicker;
-
- var fp = Components.classes["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
- fp.init(window, "Select a Test Directory", nsIFilePicker.modeGetFolder);
-
- var rv = fp.show();
- if (rv == Components.interfaces.nsIFilePicker.returnOK){
- // file is the given directory (nsIFile)
- var array = [];
- //iterate directories recursively
- recurseDir = function(ent){
- var entries = ent;
- while(entries.hasMoreElements())
- {
- var entry = entries.getNext();
- entry.QueryInterface(Components.interfaces.nsIFile);
- if ((entry.isDirectory()) && (entry.path.indexOf('.svn') == -1)){
- recurseDir(entry.directoryEntries);
- }
- //push js files onto the array
- if (entry.path.indexOf('.js') != -1){
- array.push(entry.path);
- }
- }
- }
- //build the files array
- recurseDir(fp.file.directoryEntries);
- paramObj = {};
- paramObj.files = array;
- mozmill.MozMillController.commands.jsTests(paramObj);
- }*/
-
- var runFile = function(w){
- //define the interface
- var nsIFilePicker = Components.interfaces.nsIFilePicker;
- var fp = Components.classes["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
- //define the file picker window
- fp.init(w, "Select a File", nsIFilePicker.modeOpen);
- fp.appendFilter("JavaScript Files","*.js");
- //show the window
- var res = fp.show();
- //if we got a file
- if (res == nsIFilePicker.returnOK){
- var thefile = fp.file;
- //create the paramObj with a files array attrib
- var paramObj = {};
- paramObj.files = [];
- paramObj.files.push(thefile.path);
-
- //Move focus to output tab
- //w.document.getElementById('mmtabs').setAttribute("selectedIndex", 2);
- //send it into the JS test framework to run the file
- // jstest.runFromFile(thefile.path);
- }
- };
-
- var saveFile = function(w, content, filename){
- //define the file interface
- var file = Components.classes["@mozilla.org/file/local;1"]
- .createInstance(Components.interfaces.nsILocalFile);
- //point it at the file we want to get at
- file.initWithPath(filename);
-
- // file is nsIFile, data is a string
- var foStream = Components.classes["@mozilla.org/network/file-output-stream;1"]
- .createInstance(Components.interfaces.nsIFileOutputStream);
-
- // use 0x02 | 0x10 to open file for appending.
- foStream.init(file, 0x02 | 0x08 | 0x20, 0666, 0);
- // write, create, truncate
- // In a c file operation, we have no need to set file mode with or operation,
- // directly using "r" or "w" usually.
-
- foStream.write(content, content.length);
- foStream.close();
- };
-
- var saveAsFile = function(w, content){
- //define the interface
- var nsIFilePicker = Components.interfaces.nsIFilePicker;
- var fp = Components.classes["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
- //define the file picker window
- fp.init(w, "Select a File", nsIFilePicker.modeSave);
- fp.appendFilter("JavaScript Files","*.js");
- //show the window
- var res = fp.show();
- //if we got a file
- if ((res == nsIFilePicker.returnOK) || (res == nsIFilePicker.returnReplace)){
- var thefile = fp.file;
-
- //forcing the user to save as a .js file
- if (thefile.path.indexOf(".js") == -1){
- //define the file interface
- var file = Components.classes["@mozilla.org/file/local;1"]
- .createInstance(Components.interfaces.nsILocalFile);
- //point it at the file we want to get at
- file.initWithPath(thefile.path+".js");
- var thefile = file;
- }
-
- // file is nsIFile, data is a string
- var foStream = Components.classes["@mozilla.org/network/file-output-stream;1"]
- .createInstance(Components.interfaces.nsIFileOutputStream);
-
- // use 0x02 | 0x10 to open file for appending.
- foStream.init(thefile, 0x02 | 0x08 | 0x20, 0666, 0);
- // write, create, truncate
- // In a c file operation, we have no need to set file mode with or operation,
- // directly using "r" or "w" usually.
- foStream.write(content, content.length);
- foStream.close();
- return thefile.path;
- }
- };
-
- var openFile = function(w){
- //define the interface
- var nsIFilePicker = Components.interfaces.nsIFilePicker;
- var fp = Components.classes["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
- //define the file picker window
- fp.init(w, "Select a File", nsIFilePicker.modeOpen);
- fp.appendFilter("JavaScript Files","*.js");
- //show the window
- var res = fp.show();
- //if we got a file
- if (res == nsIFilePicker.returnOK){
- var thefile = fp.file;
- //create the paramObj with a files array attrib
- var data = getFile(thefile.path);
- //w.document.getElementById('editorInput').value = data;
-
- //Move focus to output tab
- //$('mmtabs').setAttribute("selectedIndex", 2);
- //send it into the JS test framework to run the file
- //mozmill.utils.jsTests(paramObj);
- //jsTest.runFromString(thefile.path);
- return {path:thefile.path, data:data};
- }
- };
-
- var getFile = function(path){
- //define the file interface
- var file = Components.classes["@mozilla.org/file/local;1"]
- .createInstance(Components.interfaces.nsILocalFile);
- //point it at the file we want to get at
- file.initWithPath(path);
- // define file stream interfaces
- var data = "";
- var fstream = Components.classes["@mozilla.org/network/file-input-stream;1"]
- .createInstance(Components.interfaces.nsIFileInputStream);
- var sstream = Components.classes["@mozilla.org/scriptableinputstream;1"]
- .createInstance(Components.interfaces.nsIScriptableInputStream);
- fstream.init(file, -1, 0, 0);
- sstream.init(fstream);
-
- //pull the contents of the file out
- var str = sstream.read(4096);
- while (str.length > 0) {
- data += str;
- str = sstream.read(4096);
- }
-
- sstream.close();
- fstream.close();
-
- //data = data.replace(/\r|\n|\r\n/g, "");
- return data;
- };
-
-/**
- * Called to get the state of an individual preference.
- *
- * @param aPrefName string The preference to get the state of.
- * @param aDefaultValue any The default value if preference was not found.
- *
- * @returns any The value of the requested preference
- *
- * @see setPref
- * Code by Henrik Skupin: <hskupin@gmail.com>
- */
-function getPreference(aPrefName, aDefaultValue) {
- try {
- var branch = Components.classes["@mozilla.org/preferences-service;1"].
- getService(Components.interfaces.nsIPrefBranch);
- switch (typeof aDefaultValue) {
- case ('boolean'):
- return branch.getBoolPref(aPrefName);
- case ('string'):
- return branch.getCharPref(aPrefName);
- case ('number'):
- return branch.getIntPref(aPrefName);
- default:
- return branch.getComplexValue(aPrefName);
- }
- } catch(e) {
- return aDefaultValue;
- }
-}
-
-/**
- * Called to set the state of an individual preference.
- *
- * @param aPrefName string The preference to set the state of.
- * @param aValue any The value to set the preference to.
- *
- * @returns boolean Returns true if value was successfully set.
- *
- * @see getPref
- * Code by Henrik Skupin: <hskupin@gmail.com>
- */
-function setPreference(aName, aValue) {
- try {
- var branch = Components.classes["@mozilla.org/preferences-service;1"].
- getService(Components.interfaces.nsIPrefBranch);
- switch (typeof aValue) {
- case ('boolean'):
- branch.setBoolPref(aName, aValue);
- break;
- case ('string'):
- branch.setCharPref(aName, aValue);
- break;
- case ('number'):
- branch.setIntPref(aName, aValue);
- break;
- default:
- branch.setComplexValue(aName, aValue);
- }
- } catch(e) {
- return false;
- }
-
- return true;
-}
-
-/**
- * Sleep for the given amount of milliseconds
- *
- * @param {number} milliseconds
- * Sleeps the given number of milliseconds
- */
-function sleep(milliseconds) {
- // We basically just call this once after the specified number of milliseconds
- var timeup = false;
- function wait() { timeup = true; }
- hwindow.setTimeout(wait, milliseconds);
-
- var thread = Components.classes["@mozilla.org/thread-manager;1"].
- getService().currentThread;
- while(!timeup) {
- thread.processNextEvent(true);
- }
-}
-
-/**
- * Check if the callback function evaluates to true
- */
-function assert(callback, message, thisObject) {
- var result = callback.call(thisObject);
-
- if (!result) {
- throw new Error(message || arguments.callee.name + ": Failed for '" + callback + "'");
- }
-
- return true;
-}
-
-/**
- * Unwraps a node which is wrapped into a XPCNativeWrapper or XrayWrapper
- *
- * @param {DOMnode} Wrapped DOM node
- * @returns {DOMNode} Unwrapped DOM node
- */
-
-function unwrapNode(aNode) {
- var node = aNode;
- if (node) {
- // unwrap is not available on older branches (3.5 and 3.6) - Bug 533596
- if ("unwrap" in XPCNativeWrapper) {
- node = XPCNativeWrapper.unwrap(node);
- }
- else if (node.wrappedJSObject != null) {
- node = node.wrappedJSObject;
- }
- }
- return node;
-}
-
-
-/**
- * TimeoutError
- *
- * Error object used for timeouts
- */
-function TimeoutError(message, fileName, lineNumber) {
- var err = new Error();
- if (err.stack) {
- this.stack = err.stack;
- }
- this.message = message === undefined ? err.message : message;
- this.fileName = fileName === undefined ? err.fileName : fileName;
- this.lineNumber = lineNumber === undefined ? err.lineNumber : lineNumber;
-};
-TimeoutError.prototype = new Error();
-TimeoutError.prototype.constructor = TimeoutError;
-TimeoutError.prototype.name = 'TimeoutError';
-
-/**
- * Waits for the callback evaluates to true
- */
-function waitFor(callback, message, timeout, interval, thisObject) {
- timeout = timeout || 5000;
- interval = interval || 100;
-
- var self = {counter: 0, result: callback.call(thisObject)};
-
- function wait() {
- self.counter += interval;
- self.result = callback.call(thisObject);
- }
-
- var timeoutInterval = hwindow.setInterval(wait, interval);
- var thread = Components.classes["@mozilla.org/thread-manager;1"].
- getService().currentThread;
-
- while((self.result != true) && (self.counter < timeout)) {
- thread.processNextEvent(true);
- }
-
- hwindow.clearInterval(timeoutInterval);
-
- if (self.counter >= timeout) {
- message = message || arguments.callee.name + ": Timeout exceeded for '" + callback + "'";
- throw new TimeoutError(message);
- }
-
- return true;
-}
-
-/**
- * Waits until the expression evaluates to true
- */
-function waitForEval(expression, timeout, interval, subject) {
- waitFor(function() {
- return eval(expression);
- }, arguments.callee.name + ": Timeout exceeded for '" + expression + "'", timeout, interval);
-
- return true;
-}
-
-
- //
- // //Function to start the running of jsTests
- // var jsTests = function (paramObj) {
- // //Setup needed variables
- // mozmill.jsTest.actions.loadActions();
- // var wm = mozmill.jsTest.actions;
- // var testFiles = paramObj.files;
- // if (!testFiles.length) {
- // throw new Error('No JavaScript tests to run.');
- // }
- // var _j = mozmill.jsTest;
- // //mozmill.MozMillController.stopLoop();
- //
- // //Timing the suite
- // var jsSuiteSummary = new TimeObj();
- // jsSuiteSummary.setName('jsSummary');
- // jsSuiteSummary.startTime();
- // _j.jsSuiteSummary = jsSuiteSummary;
- //
- // _j.run(paramObj);
- // };
- //
- // //Commands function to hande the test results of the js tests
- // var jsTestResults = function () {
- // var _j = mozmill.jsTest;
- // var jsSuiteSummary = _j.jsSuiteSummary;
- // var s = '';
- // s += 'Number of tests run: ' + _j.testCount + '\n';
- // s += '\nNumber of tests failures: ' + _j.testFailureCount;
- // if (_j.testFailureCount > 0) {
- // s += 'Test failures:<br/>';
- // var fails = _j.testFailures;
- // for (var i = 0; i < fails.length; i++) {
- // var fail = fails[i];
- // var msg = fail.message;
- // // Escape angle brackets for display in HTML
- // msg = msg.replace(/</g, '<');
- // msg = msg.replace(/>/g, '>');
- // s += msg + '<br/>';
- // }
- // };
- //
- // jsSuiteSummary.endTime();
- // var result = !(_j.testFailureCount > 0);
- //
- // if (result){
- // mozmill.results.writeResult(s, 'lightgreen');
- // }
- // else{
- // mozmill.results.writeResult(s, 'lightred');
- // }
- // //mozmill.results.writeResult(s);
- // //We want the summary to have a concept of success/failure
- // var result = !(_j.testFailureCount > 0);
- // var method = 'JS Test Suite Completion';
- // //mozmill.jsTest.sendJSReport(method, result, null, jsSuiteSummary);
- // // Fire the polling loop back up
- // //mozmill.MozMillController.continueLoop();
- // };
deleted file mode 100644
--- a/mail/test/resources/mozmill/mozmill/extension/resource/stdlib/EventUtils.js
+++ /dev/null
@@ -1,820 +0,0 @@
-// Export all available functions for Mozmill
-var EXPORTED_SYMBOLS = ["sendMouseEvent", "sendChar", "sendString", "sendKey",
- "synthesizeMouse", "synthesizeMouseScroll", "synthesizeKey",
- "synthesizeMouseExpectEvent", "synthesizeKeyExpectEvent",
- "synthesizeDragStart", "synthesizeDrop", "synthesizeText",
- "disableNonTestMouseEvents", "synthesizeComposition",
- "synthesizeQuerySelectedText", "synthesizeQueryTextContent",
- "synthesizeQueryCaretRect", "synthesizeQueryTextRect",
- "synthesizeQueryEditorRect", "synthesizeCharAtPoint",
- "synthesizeSelectionSet"];
-
-/**
- * Get the array with available key events
- */
-function getKeyEvent(aWindow) {
- var win = aWindow.wrappedJSObject ? aWindow.wrappedJSObject : aWindow;
- return win.KeyEvent;
-}
-
-/**
- * EventUtils provides some utility methods for creating and sending DOM events.
- * Current methods:
- * sendMouseEvent
- * sendChar
- * sendString
- * sendKey
- */
-
-/**
- * Send a mouse event to the node aTarget (aTarget can be an id, or an
- * actual node) . The "event" passed in to aEvent is just a JavaScript
- * object with the properties set that the real mouse event object should
- * have. This includes the type of the mouse event.
- * E.g. to send an click event to the node with id 'node' you might do this:
- *
- * sendMouseEvent({type:'click'}, 'node');
- */
-function sendMouseEvent(aEvent, aTarget, aWindow) {
- if (['click', 'mousedown', 'mouseup', 'mouseover', 'mouseout'].indexOf(aEvent.type) == -1) {
- throw new Error("sendMouseEvent doesn't know about event type '"+aEvent.type+"'");
- }
-
- if (!aWindow) {
- aWindow = window;
- }
-
- if (!(aTarget instanceof Element)) {
- aTarget = aWindow.document.getElementById(aTarget);
- }
-
- var event = aWindow.document.createEvent('MouseEvent');
-
- var typeArg = aEvent.type;
- var canBubbleArg = true;
- var cancelableArg = true;
- var viewArg = aWindow;
- var detailArg = aEvent.detail || (aEvent.type == 'click' ||
- aEvent.type == 'mousedown' ||
- aEvent.type == 'mouseup' ? 1 : 0);
- var screenXArg = aEvent.screenX || 0;
- var screenYArg = aEvent.screenY || 0;
- var clientXArg = aEvent.clientX || 0;
- var clientYArg = aEvent.clientY || 0;
- var ctrlKeyArg = aEvent.ctrlKey || false;
- var altKeyArg = aEvent.altKey || false;
- var shiftKeyArg = aEvent.shiftKey || false;
- var metaKeyArg = aEvent.metaKey || false;
- var buttonArg = aEvent.button || 0;
- var relatedTargetArg = aEvent.relatedTarget || null;
-
- event.initMouseEvent(typeArg, canBubbleArg, cancelableArg, viewArg, detailArg,
- screenXArg, screenYArg, clientXArg, clientYArg,
- ctrlKeyArg, altKeyArg, shiftKeyArg, metaKeyArg,
- buttonArg, relatedTargetArg);
-
- aTarget.dispatchEvent(event);
-}
-
-/**
- * Send the char aChar to the node with id aTarget. If aTarget is not
- * provided, use "target". This method handles casing of chars (sends the
- * right charcode, and sends a shift key for uppercase chars). No other
- * modifiers are handled at this point.
- *
- * For now this method only works for English letters (lower and upper case)
- * and the digits 0-9.
- *
- * Returns true if the keypress event was accepted (no calls to preventDefault
- * or anything like that), false otherwise.
- */
-function sendChar(aChar, aTarget) {
- // DOM event charcodes match ASCII (JS charcodes) for a-zA-Z0-9.
- var hasShift = (aChar == aChar.toUpperCase());
- var charCode = aChar.charCodeAt(0);
- var keyCode = charCode;
- if (!hasShift) {
- // For lowercase letters, the keyCode is actually 32 less than the charCode
- keyCode -= 0x20;
- }
-
- return __doEventDispatch(aTarget, charCode, keyCode, hasShift);
-}
-
-/**
- * Send the string aStr to the node with id aTarget. If aTarget is not
- * provided, use "target".
- *
- * For now this method only works for English letters (lower and upper case)
- * and the digits 0-9.
- */
-function sendString(aStr, aTarget) {
- for (var i = 0; i < aStr.length; ++i) {
- sendChar(aStr.charAt(i), aTarget);
- }
-}
-
-/**
- * Send the non-character key aKey to the node with id aTarget. If aTarget is
- * not provided, use "target". The name of the key should be a lowercase
- * version of the part that comes after "DOM_VK_" in the KeyEvent constant
- * name for this key. No modifiers are handled at this point.
- *
- * Returns true if the keypress event was accepted (no calls to preventDefault
- * or anything like that), false otherwise.
- */
-function sendKey(aKey, aTarget, aWindow) {
- if (!aWindow)
- aWindow = window;
-
- keyName = "DOM_VK_" + aKey.toUpperCase();
-
- if (!getKeyEvent(aWindow)[keyName]) {
- throw "Unknown key: " + keyName;
- }
-
- return __doEventDispatch(aTarget, 0, getKeyEvent(aWindow)[keyName], false);
-}
-
-/**
- * Actually perform event dispatch given a charCode, keyCode, and boolean for
- * whether "shift" was pressed. Send the event to the node with id aTarget. If
- * aTarget is not provided, use "target".
- *
- * Returns true if the keypress event was accepted (no calls to preventDefault
- * or anything like that), false otherwise.
- */
-function __doEventDispatch(aTarget, aCharCode, aKeyCode, aHasShift) {
- if (aTarget === undefined) {
- aTarget = "target";
- }
-
- var event = document.createEvent("KeyEvents");
- event.initKeyEvent("keydown", true, true, document.defaultView,
- false, false, aHasShift, false,
- aKeyCode, 0);
- var accepted = $(aTarget).dispatchEvent(event);
-
- // Preventing the default keydown action also prevents the default
- // keypress action.
- event = document.createEvent("KeyEvents");
- if (aCharCode) {
- event.initKeyEvent("keypress", true, true, document.defaultView,
- false, false, aHasShift, false,
- 0, aCharCode);
- } else {
- event.initKeyEvent("keypress", true, true, document.defaultView,
- false, false, aHasShift, false,
- aKeyCode, 0);
- }
- if (!accepted) {
- event.preventDefault();
- }
- accepted = $(aTarget).dispatchEvent(event);
-
- // Always send keyup
- var event = document.createEvent("KeyEvents");
- event.initKeyEvent("keyup", true, true, document.defaultView,
- false, false, aHasShift, false,
- aKeyCode, 0);
- $(aTarget).dispatchEvent(event);
- return accepted;
-}
-
-/**
- * Parse the key modifier flags from aEvent. Used to share code between
- * synthesizeMouse and synthesizeKey.
- */
-function _parseModifiers(aEvent)
-{
- var hwindow = Components.classes["@mozilla.org/appshell/appShellService;1"]
- .getService(Components.interfaces.nsIAppShellService)
- .hiddenDOMWindow;
-
- const masks = Components.interfaces.nsIDOMNSEvent;
- var mval = 0;
- if (aEvent.shiftKey)
- mval |= masks.SHIFT_MASK;
- if (aEvent.ctrlKey)
- mval |= masks.CONTROL_MASK;
- if (aEvent.altKey)
- mval |= masks.ALT_MASK;
- if (aEvent.metaKey)
- mval |= masks.META_MASK;
- if (aEvent.accelKey)
- mval |= (hwindow.navigator.platform.indexOf("Mac") >= 0) ? masks.META_MASK :
- masks.CONTROL_MASK;
-
- return mval;
-}
-
-/**
- * Synthesize a mouse event on a target. The actual client point is determined
- * by taking the aTarget's client box and offseting it by aOffsetX and
- * aOffsetY. This allows mouse clicks to be simulated by calling this method.
- *
- * aEvent is an object which may contain the properties:
- * shiftKey, ctrlKey, altKey, metaKey, accessKey, clickCount, button, type
- *
- * If the type is specified, an mouse event of that type is fired. Otherwise,
- * a mousedown followed by a mouse up is performed.
- *
- * aWindow is optional, and defaults to the current window object.
- */
-function synthesizeMouse(aTarget, aOffsetX, aOffsetY, aEvent, aWindow)
-{
- if (!aWindow)
- aWindow = window;
-
- var utils = aWindow.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
- getInterface(Components.interfaces.nsIDOMWindowUtils);
- if (utils) {
- var button = aEvent.button || 0;
- var clickCount = aEvent.clickCount || 1;
- var modifiers = _parseModifiers(aEvent);
-
- var rect = aTarget.getBoundingClientRect();
-
- var left = rect.left + aOffsetX;
- var top = rect.top + aOffsetY;
-
- if (aEvent.type) {
- utils.sendMouseEvent(aEvent.type, left, top, button, clickCount, modifiers);
- }
- else {
- utils.sendMouseEvent("mousedown", left, top, button, clickCount, modifiers);
- utils.sendMouseEvent("mouseup", left, top, button, clickCount, modifiers);
- }
- }
-}
-
-/**
- * Synthesize a mouse scroll event on a target. The actual client point is determined
- * by taking the aTarget's client box and offseting it by aOffsetX and
- * aOffsetY.
- *
- * aEvent is an object which may contain the properties:
- * shiftKey, ctrlKey, altKey, metaKey, accessKey, button, type, axis, delta, hasPixels
- *
- * If the type is specified, a mouse scroll event of that type is fired. Otherwise,
- * "DOMMouseScroll" is used.
- *
- * If the axis is specified, it must be one of "horizontal" or "vertical". If not specified,
- * "vertical" is used.
- *
- * 'delta' is the amount to scroll by (can be positive or negative). It must
- * be specified.
- *
- * 'hasPixels' specifies whether kHasPixels should be set in the scrollFlags.
- *
- * aWindow is optional, and defaults to the current window object.
- */
-function synthesizeMouseScroll(aTarget, aOffsetX, aOffsetY, aEvent, aWindow)
-{
- if (!aWindow)
- aWindow = window;
-
- var utils = aWindow.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
- getInterface(Components.interfaces.nsIDOMWindowUtils);
- if (utils) {
- // See nsMouseScrollFlags in nsGUIEvent.h
- const kIsVertical = 0x02;
- const kIsHorizontal = 0x04;
- const kHasPixels = 0x08;
-
- var button = aEvent.button || 0;
- var modifiers = _parseModifiers(aEvent);
-
- var rect = aTarget.getBoundingClientRect();
-
- var left = rect.left;
- var top = rect.top;
-
- var type = aEvent.type || "DOMMouseScroll";
- var axis = aEvent.axis || "vertical";
- var scrollFlags = (axis == "horizontal") ? kIsHorizontal : kIsVertical;
- if (aEvent.hasPixels) {
- scrollFlags |= kHasPixels;
- }
- utils.sendMouseScrollEvent(type, left + aOffsetX, top + aOffsetY, button,
- scrollFlags, aEvent.delta, modifiers);
- }
-}
-
-/**
- * Synthesize a key event. It is targeted at whatever would be targeted by an
- * actual keypress by the user, typically the focused element.
- *
- * aKey should be either a character or a keycode starting with VK_ such as
- * VK_ENTER.
- *
- * aEvent is an object which may contain the properties:
- * shiftKey, ctrlKey, altKey, metaKey, accessKey, type
- *
- * If the type is specified, a key event of that type is fired. Otherwise,
- * a keydown, a keypress and then a keyup event are fired in sequence.
- *
- * aWindow is optional, and defaults to the current window object.
- */
-function synthesizeKey(aKey, aEvent, aWindow)
-{
- if (!aWindow)
- aWindow = window;
-
- var utils = aWindow.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
- getInterface(Components.interfaces.nsIDOMWindowUtils);
- if (utils) {
- var keyCode = 0, charCode = 0;
- if (aKey.indexOf("VK_") == 0)
- keyCode = getKeyEvent(aWindow)["DOM_" + aKey];
- else
- charCode = aKey.charCodeAt(0);
-
- var modifiers = _parseModifiers(aEvent);
-
- if (aEvent.type) {
- utils.sendKeyEvent(aEvent.type, keyCode, charCode, modifiers);
- }
- else {
- var keyDownDefaultHappened =
- utils.sendKeyEvent("keydown", keyCode, charCode, modifiers);
- utils.sendKeyEvent("keypress", keyCode, charCode, modifiers,
- !keyDownDefaultHappened);
- utils.sendKeyEvent("keyup", keyCode, charCode, modifiers);
- }
- }
-}
-
-var _gSeenEvent = false;
-
-/**
- * Indicate that an event with an original target of aExpectedTarget and
- * a type of aExpectedEvent is expected to be fired, or not expected to
- * be fired.
- */
-function _expectEvent(aExpectedTarget, aExpectedEvent, aTestName)
-{
- if (!aExpectedTarget || !aExpectedEvent)
- return null;
-
- _gSeenEvent = false;
-
- var type = (aExpectedEvent.charAt(0) == "!") ?
- aExpectedEvent.substring(1) : aExpectedEvent;
- var eventHandler = function(event) {
- var epassed = (!_gSeenEvent && event.originalTarget == aExpectedTarget &&
- event.type == type);
- if (!epassed)
- throw new Error(aTestName + " " + type + " event target " +
- (_gSeenEvent ? "twice" : ""));
- _gSeenEvent = true;
- };
-
- aExpectedTarget.addEventListener(type, eventHandler, false);
- return eventHandler;
-}
-
-/**
- * Check if the event was fired or not. The event handler aEventHandler
- * will be removed.
- */
-function _checkExpectedEvent(aExpectedTarget, aExpectedEvent, aEventHandler, aTestName)
-{
- if (aEventHandler) {
- var expectEvent = (aExpectedEvent.charAt(0) != "!");
- var type = expectEvent ? aExpectedEvent : aExpectedEvent.substring(1);
- aExpectedTarget.removeEventListener(type, aEventHandler, false);
- var desc = type + " event";
- if (expectEvent)
- desc += " not";
- if (_gSeenEvent != expectEvent)
- throw new Error(aTestName + ": " + desc + " fired.");
- }
-
- _gSeenEvent = false;
-}
-
-/**
- * Similar to synthesizeMouse except that a test is performed to see if an
- * event is fired at the right target as a result.
- *
- * aExpectedTarget - the expected originalTarget of the event.
- * aExpectedEvent - the expected type of the event, such as 'select'.
- * aTestName - the test name when outputing results
- *
- * To test that an event is not fired, use an expected type preceded by an
- * exclamation mark, such as '!select'. This might be used to test that a
- * click on a disabled element doesn't fire certain events for instance.
- *
- * aWindow is optional, and defaults to the current window object.
- */
-function synthesizeMouseExpectEvent(aTarget, aOffsetX, aOffsetY, aEvent,
- aExpectedTarget, aExpectedEvent, aTestName,
- aWindow)
-{
- var eventHandler = _expectEvent(aExpectedTarget, aExpectedEvent, aTestName);
- synthesizeMouse(aTarget, aOffsetX, aOffsetY, aEvent, aWindow);
- _checkExpectedEvent(aExpectedTarget, aExpectedEvent, eventHandler, aTestName);
-}
-
-/**
- * Similar to synthesizeKey except that a test is performed to see if an
- * event is fired at the right target as a result.
- *
- * aExpectedTarget - the expected originalTarget of the event.
- * aExpectedEvent - the expected type of the event, such as 'select'.
- * aTestName - the test name when outputing results
- *
- * To test that an event is not fired, use an expected type preceded by an
- * exclamation mark, such as '!select'.
- *
- * aWindow is optional, and defaults to the current window object.
- */
-function synthesizeKeyExpectEvent(key, aEvent, aExpectedTarget, aExpectedEvent,
- aTestName, aWindow)
-{
- var eventHandler = _expectEvent(aExpectedTarget, aExpectedEvent, aTestName);
- synthesizeKey(key, aEvent, aWindow);
- _checkExpectedEvent(aExpectedTarget, aExpectedEvent, eventHandler, aTestName);
-}
-
-/**
- * Emulate a dragstart event.
- * element - element to fire the dragstart event on
- * expectedDragData - the data you expect the data transfer to contain afterwards
- * This data is in the format:
- * [ [ {type: value, data: value, test: function}, ... ], ... ]
- * can be null
- * aWindow - optional; defaults to the current window object.
- * x - optional; initial x coordinate
- * y - optional; initial y coordinate
- * Returns null if data matches.
- * Returns the event.dataTransfer if data does not match
- *
- * eqTest is an optional function if comparison can't be done with x == y;
- * function (actualData, expectedData) {return boolean}
- * @param actualData from dataTransfer
- * @param expectedData from expectedDragData
- * see bug 462172 for example of use
- *
- */
-function synthesizeDragStart(element, expectedDragData, aWindow, x, y)
-{
- if (!aWindow)
- aWindow = window;
- x = x || 2;
- y = y || 2;
- const step = 9;
-
- var result = "trapDrag was not called";
- var trapDrag = function(event) {
- try {
- var dataTransfer = event.dataTransfer;
- result = null;
- if (!dataTransfer)
- throw "no dataTransfer";
- if (expectedDragData == null ||
- dataTransfer.mozItemCount != expectedDragData.length)
- throw dataTransfer;
- for (var i = 0; i < dataTransfer.mozItemCount; i++) {
- var dtTypes = dataTransfer.mozTypesAt(i);
- if (dtTypes.length != expectedDragData[i].length)
- throw dataTransfer;
- for (var j = 0; j < dtTypes.length; j++) {
- if (dtTypes[j] != expectedDragData[i][j].type)
- throw dataTransfer;
- var dtData = dataTransfer.mozGetDataAt(dtTypes[j],i);
- if (expectedDragData[i][j].eqTest) {
- if (!expectedDragData[i][j].eqTest(dtData, expectedDragData[i][j].data))
- throw dataTransfer;
- }
- else if (expectedDragData[i][j].data != dtData)
- throw dataTransfer;
- }
- }
- } catch(ex) {
- result = ex;
- }
- event.preventDefault();
- event.stopPropagation();
- }
- aWindow.addEventListener("dragstart", trapDrag, false);
- synthesizeMouse(element, x, y, { type: "mousedown" }, aWindow);
- x += step; y += step;
- synthesizeMouse(element, x, y, { type: "mousemove" }, aWindow);
- x += step; y += step;
- synthesizeMouse(element, x, y, { type: "mousemove" }, aWindow);
- aWindow.removeEventListener("dragstart", trapDrag, false);
- synthesizeMouse(element, x, y, { type: "mouseup" }, aWindow);
- return result;
-}
-
-/**
- * Emulate a drop by emulating a dragstart and firing events dragenter, dragover, and drop.
- * srcElement - the element to use to start the drag, usually the same as destElement
- * but if destElement isn't suitable to start a drag on pass a suitable
- * element for srcElement
- * destElement - the element to fire the dragover, dragleave and drop events
- * dragData - the data to supply for the data transfer
- * This data is in the format:
- * [ [ {type: value, data: value}, ...], ... ]
- * dropEffect - the drop effect to set during the dragstart event, or 'move' if null
- * aWindow - optional; defaults to the current window object.
- *
- * Returns the drop effect that was desired.
- */
-function synthesizeDrop(srcElement, destElement, dragData, dropEffect, aWindow)
-{
- if (!aWindow)
- aWindow = window;
-
- var dataTransfer;
- var trapDrag = function(event) {
- dataTransfer = event.dataTransfer;
- for (var i = 0; i < dragData.length; i++) {
- var item = dragData[i];
- for (var j = 0; j < item.length; j++) {
- dataTransfer.mozSetDataAt(item[j].type, item[j].data, i);
- }
- }
- dataTransfer.dropEffect = dropEffect || "move";
- event.preventDefault();
- event.stopPropagation();
- }
-
- // need to use real mouse action
- aWindow.addEventListener("dragstart", trapDrag, true);
- synthesizeMouse(srcElement, 2, 2, { type: "mousedown" }, aWindow);
- synthesizeMouse(srcElement, 11, 11, { type: "mousemove" }, aWindow);
- synthesizeMouse(srcElement, 20, 20, { type: "mousemove" }, aWindow);
- aWindow.removeEventListener("dragstart", trapDrag, true);
-
- event = aWindow.document.createEvent("DragEvents");
- event.initDragEvent("dragenter", true, true, aWindow, 0, 0, 0, 0, 0, false, false, false, false, 0, null, dataTransfer);
- destElement.dispatchEvent(event);
-
- var event = aWindow.document.createEvent("DragEvents");
- event.initDragEvent("dragover", true, true, aWindow, 0, 0, 0, 0, 0, false, false, false, false, 0, null, dataTransfer);
- if (destElement.dispatchEvent(event)) {
- synthesizeMouse(destElement, 20, 20, { type: "mouseup" }, aWindow);
- return "none";
- }
-
- if (dataTransfer.dropEffect != "none") {
- event = aWindow.document.createEvent("DragEvents");
- event.initDragEvent("drop", true, true, aWindow, 0, 0, 0, 0, 0, false, false, false, false, 0, null, dataTransfer);
- destElement.dispatchEvent(event);
- }
- synthesizeMouse(destElement, 20, 20, { type: "mouseup" }, aWindow);
-
- return dataTransfer.dropEffect;
-}
-
-function disableNonTestMouseEvents(aDisable)
-{
- var utils =
- window.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
- getInterface(Components.interfaces.nsIDOMWindowUtils);
- if (utils)
- utils.disableNonTestMouseEvents(aDisable);
-}
-
-function _getDOMWindowUtils(aWindow)
-{
- if (!aWindow) {
- aWindow = window;
- }
- return aWindow.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
- getInterface(Components.interfaces.nsIDOMWindowUtils);
-}
-
-/**
- * Synthesize a composition event.
- *
- * @param aIsCompositionStart If true, this synthesize compositionstart event.
- * Otherwise, compositionend event.
- * @param aWindow Optional (If null, current |window| will be used)
- */
-function synthesizeComposition(aIsCompositionStart, aWindow)
-{
- var utils = _getDOMWindowUtils(aWindow);
- if (!utils) {
- return;
- }
-
- utils.sendCompositionEvent(aIsCompositionStart ?
- "compositionstart" : "compositionend");
-}
-
-/**
- * Synthesize a text event.
- *
- * @param aEvent The text event's information, this has |composition|
- * and |caret| members. |composition| has |string| and
- * |clauses| members. |clauses| must be array object. Each
- * object has |length| and |attr|. And |caret| has |start| and
- * |length|. See the following tree image.
- *
- * aEvent
- * +-- composition
- * | +-- string
- * | +-- clauses[]
- * | +-- length
- * | +-- attr
- * +-- caret
- * +-- start
- * +-- length
- *
- * Set the composition string to |composition.string|. Set its
- * clauses information to the |clauses| array.
- *
- * When it's composing, set the each clauses' length to the
- * |composition.clauses[n].length|. The sum of the all length
- * values must be same as the length of |composition.string|.
- * Set nsIDOMWindowUtils.COMPOSITION_ATTR_* to the
- * |composition.clauses[n].attr|.
- *
- * When it's not composing, set 0 to the
- * |composition.clauses[0].length| and
- * |composition.clauses[0].attr|.
- *
- * Set caret position to the |caret.start|. It's offset from
- * the start of the composition string. Set caret length to
- * |caret.length|. If it's larger than 0, it should be wide
- * caret. However, current nsEditor doesn't support wide
- * caret, therefore, you should always set 0 now.
- *
- * @param aWindow Optional (If null, current |window| will be used)
- */
-function synthesizeText(aEvent, aWindow)
-{
- var utils = _getDOMWindowUtils(aWindow);
- if (!utils) {
- return;
- }
-
- if (!aEvent.composition || !aEvent.composition.clauses ||
- !aEvent.composition.clauses[0]) {
- return;
- }
-
- var firstClauseLength = aEvent.composition.clauses[0].length;
- var firstClauseAttr = aEvent.composition.clauses[0].attr;
- var secondClauseLength = 0;
- var secondClauseAttr = 0;
- var thirdClauseLength = 0;
- var thirdClauseAttr = 0;
- if (aEvent.composition.clauses[1]) {
- secondClauseLength = aEvent.composition.clauses[1].length;
- secondClauseAttr = aEvent.composition.clauses[1].attr;
- if (aEvent.composition.clauses[2]) {
- thirdClauseLength = aEvent.composition.clauses[2].length;
- thirdClauseAttr = aEvent.composition.clauses[2].attr;
- }
- }
-
- var caretStart = -1;
- var caretLength = 0;
- if (aEvent.caret) {
- caretStart = aEvent.caret.start;
- caretLength = aEvent.caret.length;
- }
-
- utils.sendTextEvent(aEvent.composition.string,
- firstClauseLength, firstClauseAttr,
- secondClauseLength, secondClauseAttr,
- thirdClauseLength, thirdClauseAttr,
- caretStart, caretLength);
-}
-
-/**
- * Synthesize a query selected text event.
- *
- * @param aWindow Optional (If null, current |window| will be used)
- * @return An nsIQueryContentEventResult object. If this failed,
- * the result might be null.
- */
-function synthesizeQuerySelectedText(aWindow)
-{
- var utils = _getDOMWindowUtils(aWindow);
- if (!utils) {
- return nsnull;
- }
- return utils.sendQueryContentEvent(utils.QUERY_SELECTED_TEXT, 0, 0, 0, 0);
-}
-
-/**
- * Synthesize a query text content event.
- *
- * @param aOffset The character offset. 0 means the first character in the
- * selection root.
- * @param aLength The length of getting text. If the length is too long,
- * the extra length is ignored.
- * @param aWindow Optional (If null, current |window| will be used)
- * @return An nsIQueryContentEventResult object. If this failed,
- * the result might be null.
- */
-function synthesizeQueryTextContent(aOffset, aLength, aWindow)
-{
- var utils = _getDOMWindowUtils(aWindow);
- if (!utils) {
- return nsnull;
- }
- return utils.sendQueryContentEvent(utils.QUERY_TEXT_CONTENT,
- aOffset, aLength, 0, 0);
-}
-
-/**
- * Synthesize a query caret rect event.
- *
- * @param aOffset The caret offset. 0 means left side of the first character
- * in the selection root.
- * @param aWindow Optional (If null, current |window| will be used)
- * @return An nsIQueryContentEventResult object. If this failed,
- * the result might be null.
- */
-function synthesizeQueryCaretRect(aOffset, aWindow)
-{
- var utils = _getDOMWindowUtils(aWindow);
- if (!utils) {
- return nsnull;
- }
- return utils.sendQueryContentEvent(utils.QUERY_CARET_RECT,
- aOffset, 0, 0, 0);
-}
-
-/**
- * Synthesize a query text rect event.
- *
- * @param aOffset The character offset. 0 means the first character in the
- * selection root.
- * @param aLength The length of the text. If the length is too long,
- * the extra length is ignored.
- * @param aWindow Optional (If null, current |window| will be used)
- * @return An nsIQueryContentEventResult object. If this failed,
- * the result might be null.
- */
-function synthesizeQueryTextRect(aOffset, aLength, aWindow)
-{
- var utils = _getDOMWindowUtils(aWindow);
- if (!utils) {
- return nsnull;
- }
- return utils.sendQueryContentEvent(utils.QUERY_TEXT_RECT,
- aOffset, aLength, 0, 0);
-}
-
-/**
- * Synthesize a query editor rect event.
- *
- * @param aWindow Optional (If null, current |window| will be used)
- * @return An nsIQueryContentEventResult object. If this failed,
- * the result might be null.
- */
-function synthesizeQueryEditorRect(aWindow)
-{
- var utils = _getDOMWindowUtils(aWindow);
- if (!utils) {
- return nsnull;
- }
- return utils.sendQueryContentEvent(utils.QUERY_EDITOR_RECT, 0, 0, 0, 0);
-}
-
-/**
- * Synthesize a character at point event.
- *
- * @param aX, aY The offset in the client area of the DOM window.
- * @param aWindow Optional (If null, current |window| will be used)
- * @return An nsIQueryContentEventResult object. If this failed,
- * the result might be null.
- */
-function synthesizeCharAtPoint(aX, aY, aWindow)
-{
- var utils = _getDOMWindowUtils(aWindow);
- if (!utils) {
- return nsnull;
- }
- return utils.sendQueryContentEvent(utils.QUERY_CHARACTER_AT_POINT,
- 0, 0, aX, aY);
-}
-
-/**
- * Synthesize a selection set event.
- *
- * @param aOffset The character offset. 0 means the first character in the
- * selection root.
- * @param aLength The length of the text. If the length is too long,
- * the extra length is ignored.
- * @param aReverse If true, the selection is from |aOffset + aLength| to
- * |aOffset|. Otherwise, from |aOffset| to |aOffset + aLength|.
- * @param aWindow Optional (If null, current |window| will be used)
- * @return True, if succeeded. Otherwise false.
- */
-function synthesizeSelectionSet(aOffset, aLength, aReverse, aWindow)
-{
- var utils = _getDOMWindowUtils(aWindow);
- if (!utils) {
- return false;
- }
- return utils.sendSelectionSetEvent(aOffset, aLength, aReverse);
-}
deleted file mode 100644
--- a/mail/test/resources/mozmill/mozmill/extension/resource/stdlib/arrays.js
+++ /dev/null
@@ -1,93 +0,0 @@
-// ***** BEGIN LICENSE BLOCK *****// ***** BEGIN LICENSE BLOCK *****
-// Version: MPL 1.1/GPL 2.0/LGPL 2.1
-//
-// The contents of this file are subject to the Mozilla Public License Version
-// 1.1 (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-// http://www.mozilla.org/MPL/
-//
-// Software distributed under the License is distributed on an "AS IS" basis,
-// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-// for the specific language governing rights and limitations under the
-// License.
-//
-// The Original Code is Mozilla Corporation Code.
-//
-// The Initial Developer of the Original Code is
-// Mikeal Rogers.
-// Portions created by the Initial Developer are Copyright (C) 2008
-// the Initial Developer. All Rights Reserved.
-//
-// Contributor(s):
-// Mikeal Rogers <mikeal.rogers@gmail.com>
-//
-// Alternatively, the contents of this file may be used under the terms of
-// either the GNU General Public License Version 2 or later (the "GPL"), or
-// the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-// in which case the provisions of the GPL or the LGPL are applicable instead
-// of those above. If you wish to allow use of your version of this file only
-// under the terms of either the GPL or the LGPL, and not to allow others to
-// use your version of this file under the terms of the MPL, indicate your
-// decision by deleting the provisions above and replace them with the notice
-// and other provisions required by the GPL or the LGPL. If you do not delete
-// the provisions above, a recipient may use your version of this file under
-// the terms of any one of the MPL, the GPL or the LGPL.
-//
-// ***** END LICENSE BLOCK *****
-
-var EXPORTED_SYMBOLS = ['inArray', 'getSet', 'indexOf', 'rindexOf', 'compare'];
-
-function inArray (array, value) {
- for (i in array) {
- if (value == array[i]) {
- return true;
- }
- }
- return false;
-}
-
-function getSet (array) {
- var narray = [];
- for (i in array) {
- if ( !inArray(narray, array[i]) ) {
- narray.push(array[i]);
- }
- }
- return narray;
-}
-
-function indexOf (array, v, offset) {
- for (i in array) {
- if (offset == undefined || i >= offset) {
- if ( !isNaN(i) && array[i] == v) {
- return new Number(i);
- }
- }
- }
- return -1;
-}
-
-function rindexOf (array, v) {
- var l = array.length;
- for (i in array) {
- if (!isNaN(i)) {
- var i = new Number(i)
- }
- if (!isNaN(i) && array[l - i] == v) {
- return l - i;
- }
- }
- return -1;
-}
-
-function compare (array, carray) {
- if (array.length != carray.length) {
- return false;
- }
- for (i in array) {
- if (array[i] != carray[i]) {
- return false;
- }
- }
- return true;
-}
\ No newline at end of file
deleted file mode 100644
--- a/mail/test/resources/mozmill/mozmill/extension/resource/stdlib/dom.js
+++ /dev/null
@@ -1,54 +0,0 @@
-// ***** BEGIN LICENSE BLOCK *****// ***** BEGIN LICENSE BLOCK *****
-// Version: MPL 1.1/GPL 2.0/LGPL 2.1
-//
-// The contents of this file are subject to the Mozilla Public License Version
-// 1.1 (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-// http://www.mozilla.org/MPL/
-//
-// Software distributed under the License is distributed on an "AS IS" basis,
-// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-// for the specific language governing rights and limitations under the
-// License.
-//
-// The Original Code is Mozilla Corporation Code.
-//
-// The Initial Developer of the Original Code is
-// Mikeal Rogers.
-// Portions created by the Initial Developer are Copyright (C) 2008
-// the Initial Developer. All Rights Reserved.
-//
-// Contributor(s):
-// Mikeal Rogers <mikeal.rogers@gmail.com>
-//
-// Alternatively, the contents of this file may be used under the terms of
-// either the GNU General Public License Version 2 or later (the "GPL"), or
-// the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-// in which case the provisions of the GPL or the LGPL are applicable instead
-// of those above. If you wish to allow use of your version of this file only
-// under the terms of either the GPL or the LGPL, and not to allow others to
-// use your version of this file under the terms of the MPL, indicate your
-// decision by deleting the provisions above and replace them with the notice
-// and other provisions required by the GPL or the LGPL. If you do not delete
-// the provisions above, a recipient may use your version of this file under
-// the terms of any one of the MPL, the GPL or the LGPL.
-//
-// ***** END LICENSE BLOCK *****
-
-var EXPORTED_SYMBOLS = ['getAttributes'];
-
-
-var getAttributes = function (node) {
- var attributes = {};
- for (i in node.attributes) {
- if ( !isNaN(i) ) {
- try {
- var attr = node.attributes[i];
- attributes[attr.name] = attr.value;
- } catch (err) {
- }
- }
- }
- return attributes;
-}
-
deleted file mode 100644
--- a/mail/test/resources/mozmill/mozmill/extension/resource/stdlib/httpd.js
+++ /dev/null
@@ -1,5202 +0,0 @@
-/* -*- Mode: JavaScript; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is the httpd.js server.
- *
- * The Initial Developer of the Original Code is
- * Mozilla Corporation.
- * Portions created by the Initial Developer are Copyright (C) 2006
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- * Darin Fisher (v1, netwerk/test/TestServ.js)
- * Christian Biesinger (v2, netwerk/test/unit/head_http_server.js)
- * Jeff Walden <jwalden+code@mit.edu> (v3, netwerk/test/httpserver/httpd.js)
- * Robert Sayre <sayrer@gmail.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-/*
- * An implementation of an HTTP server both as a loadable script and as an XPCOM
- * component. See the accompanying README file for user documentation on
- * httpd.js.
- */
-
-Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
-
-var EXPORTED_SYMBOLS = ['getServer'];
-
-/**
- * Overwrite both dump functions because we do not wanna have this output for Mozmill
- */
-function dump() {}
-function dumpn() {}
-
-const Cc = Components.classes;
-const Ci = Components.interfaces;
-const Cr = Components.results;
-const Cu = Components.utils;
-const CC = Components.Constructor;
-
-const PR_UINT32_MAX = Math.pow(2, 32) - 1;
-
-/** True if debugging output is enabled, false otherwise. */
-var DEBUG = false; // non-const *only* so tweakable in server tests
-
-/** True if debugging output should be timestamped. */
-var DEBUG_TIMESTAMP = false; // non-const so tweakable in server tests
-
-var gGlobalObject = this;
-
-/**
- * Asserts that the given condition holds. If it doesn't, the given message is
- * dumped, a stack trace is printed, and an exception is thrown to attempt to
- * stop execution (which unfortunately must rely upon the exception not being
- * accidentally swallowed by the code that uses it).
- */
-function NS_ASSERT(cond, msg)
-{
- if (DEBUG && !cond)
- {
- dumpn("###!!!");
- dumpn("###!!! ASSERTION" + (msg ? ": " + msg : "!"));
- dumpn("###!!! Stack follows:");
-
- var stack = new Error().stack.split(/\n/);
- dumpn(stack.map(function(val) { return "###!!! " + val; }).join("\n"));
-
- throw Cr.NS_ERROR_ABORT;
- }
-}
-
-/** Constructs an HTTP error object. */
-function HttpError(code, description)
-{
- this.code = code;
- this.description = description;
-}
-HttpError.prototype =
-{
- toString: function()
- {
- return this.code + " " + this.description;
- }
-};
-
-/**
- * Errors thrown to trigger specific HTTP server responses.
- */
-const HTTP_400 = new HttpError(400, "Bad Request");
-const HTTP_401 = new HttpError(401, "Unauthorized");
-const HTTP_402 = new HttpError(402, "Payment Required");
-const HTTP_403 = new HttpError(403, "Forbidden");
-const HTTP_404 = new HttpError(404, "Not Found");
-const HTTP_405 = new HttpError(405, "Method Not Allowed");
-const HTTP_406 = new HttpError(406, "Not Acceptable");
-const HTTP_407 = new HttpError(407, "Proxy Authentication Required");
-const HTTP_408 = new HttpError(408, "Request Timeout");
-const HTTP_409 = new HttpError(409, "Conflict");
-const HTTP_410 = new HttpError(410, "Gone");
-const HTTP_411 = new HttpError(411, "Length Required");
-const HTTP_412 = new HttpError(412, "Precondition Failed");
-const HTTP_413 = new HttpError(413, "Request Entity Too Large");
-const HTTP_414 = new HttpError(414, "Request-URI Too Long");
-const HTTP_415 = new HttpError(415, "Unsupported Media Type");
-const HTTP_417 = new HttpError(417, "Expectation Failed");
-
-const HTTP_500 = new HttpError(500, "Internal Server Error");
-const HTTP_501 = new HttpError(501, "Not Implemented");
-const HTTP_502 = new HttpError(502, "Bad Gateway");
-const HTTP_503 = new HttpError(503, "Service Unavailable");
-const HTTP_504 = new HttpError(504, "Gateway Timeout");
-const HTTP_505 = new HttpError(505, "HTTP Version Not Supported");
-
-/** Creates a hash with fields corresponding to the values in arr. */
-function array2obj(arr)
-{
- var obj = {};
- for (var i = 0; i < arr.length; i++)
- obj[arr[i]] = arr[i];
- return obj;
-}
-
-/** Returns an array of the integers x through y, inclusive. */
-function range(x, y)
-{
- var arr = [];
- for (var i = x; i <= y; i++)
- arr.push(i);
- return arr;
-}
-
-/** An object (hash) whose fields are the numbers of all HTTP error codes. */
-const HTTP_ERROR_CODES = array2obj(range(400, 417).concat(range(500, 505)));
-
-
-/**
- * The character used to distinguish hidden files from non-hidden files, a la
- * the leading dot in Apache. Since that mechanism also hides files from
- * easy display in LXR, ls output, etc. however, we choose instead to use a
- * suffix character. If a requested file ends with it, we append another
- * when getting the file on the server. If it doesn't, we just look up that
- * file. Therefore, any file whose name ends with exactly one of the character
- * is "hidden" and available for use by the server.
- */
-const HIDDEN_CHAR = "^";
-
-/**
- * The file name suffix indicating the file containing overridden headers for
- * a requested file.
- */
-const HEADERS_SUFFIX = HIDDEN_CHAR + "headers" + HIDDEN_CHAR;
-
-/** Type used to denote SJS scripts for CGI-like functionality. */
-const SJS_TYPE = "sjs";
-
-/** Base for relative timestamps produced by dumpn(). */
-var firstStamp = 0;
-
-/** dump(str) with a trailing "\n" -- only outputs if DEBUG. */
-function dumpn(str)
-{
- if (DEBUG)
- {
- var prefix = "HTTPD-INFO | ";
- if (DEBUG_TIMESTAMP)
- {
- if (firstStamp === 0)
- firstStamp = Date.now();
-
- var elapsed = Date.now() - firstStamp; // milliseconds
- var min = Math.floor(elapsed / 60000);
- var sec = (elapsed % 60000) / 1000;
-
- if (sec < 10)
- prefix += min + ":0" + sec.toFixed(3) + " | ";
- else
- prefix += min + ":" + sec.toFixed(3) + " | ";
- }
-
- dump(prefix + str + "\n");
- }
-}
-
-/** Dumps the current JS stack if DEBUG. */
-function dumpStack()
-{
- // peel off the frames for dumpStack() and Error()
- var stack = new Error().stack.split(/\n/).slice(2);
- stack.forEach(dumpn);
-}
-
-
-/** The XPCOM thread manager. */
-var gThreadManager = null;
-
-/** The XPCOM prefs service. */
-var gRootPrefBranch = null;
-function getRootPrefBranch()
-{
- if (!gRootPrefBranch)
- {
- gRootPrefBranch = Cc["@mozilla.org/preferences-service;1"]
- .getService(Ci.nsIPrefBranch);
- }
- return gRootPrefBranch;
-}
-
-/**
- * JavaScript constructors for commonly-used classes; precreating these is a
- * speedup over doing the same from base principles. See the docs at
- * http://developer.mozilla.org/en/docs/Components.Constructor for details.
- */
-const ServerSocket = CC("@mozilla.org/network/server-socket;1",
- "nsIServerSocket",
- "init");
-const ScriptableInputStream = CC("@mozilla.org/scriptableinputstream;1",
- "nsIScriptableInputStream",
- "init");
-const Pipe = CC("@mozilla.org/pipe;1",
- "nsIPipe",
- "init");
-const FileInputStream = CC("@mozilla.org/network/file-input-stream;1",
- "nsIFileInputStream",
- "init");
-const ConverterInputStream = CC("@mozilla.org/intl/converter-input-stream;1",
- "nsIConverterInputStream",
- "init");
-const WritablePropertyBag = CC("@mozilla.org/hash-property-bag;1",
- "nsIWritablePropertyBag2");
-const SupportsString = CC("@mozilla.org/supports-string;1",
- "nsISupportsString");
-
-/* These two are non-const only so a test can overwrite them. */
-var BinaryInputStream = CC("@mozilla.org/binaryinputstream;1",
- "nsIBinaryInputStream",
- "setInputStream");
-var BinaryOutputStream = CC("@mozilla.org/binaryoutputstream;1",
- "nsIBinaryOutputStream",
- "setOutputStream");
-
-/**
- * Returns the RFC 822/1123 representation of a date.
- *
- * @param date : Number
- * the date, in milliseconds from midnight (00:00:00), January 1, 1970 GMT
- * @returns string
- * the representation of the given date
- */
-function toDateString(date)
-{
- //
- // rfc1123-date = wkday "," SP date1 SP time SP "GMT"
- // date1 = 2DIGIT SP month SP 4DIGIT
- // ; day month year (e.g., 02 Jun 1982)
- // time = 2DIGIT ":" 2DIGIT ":" 2DIGIT
- // ; 00:00:00 - 23:59:59
- // wkday = "Mon" | "Tue" | "Wed"
- // | "Thu" | "Fri" | "Sat" | "Sun"
- // month = "Jan" | "Feb" | "Mar" | "Apr"
- // | "May" | "Jun" | "Jul" | "Aug"
- // | "Sep" | "Oct" | "Nov" | "Dec"
- //
-
- const wkdayStrings = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
- const monthStrings = ["Jan", "Feb", "Mar", "Apr", "May", "Jun",
- "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
-
- /**
- * Processes a date and returns the encoded UTC time as a string according to
- * the format specified in RFC 2616.
- *
- * @param date : Date
- * the date to process
- * @returns string
- * a string of the form "HH:MM:SS", ranging from "00:00:00" to "23:59:59"
- */
- function toTime(date)
- {
- var hrs = date.getUTCHours();
- var rv = (hrs < 10) ? "0" + hrs : hrs;
-
- var mins = date.getUTCMinutes();
- rv += ":";
- rv += (mins < 10) ? "0" + mins : mins;
-
- var secs = date.getUTCSeconds();
- rv += ":";
- rv += (secs < 10) ? "0" + secs : secs;
-
- return rv;
- }
-
- /**
- * Processes a date and returns the encoded UTC date as a string according to
- * the date1 format specified in RFC 2616.
- *
- * @param date : Date
- * the date to process
- * @returns string
- * a string of the form "HH:MM:SS", ranging from "00:00:00" to "23:59:59"
- */
- function toDate1(date)
- {
- var day = date.getUTCDate();
- var month = date.getUTCMonth();
- var year = date.getUTCFullYear();
-
- var rv = (day < 10) ? "0" + day : day;
- rv += " " + monthStrings[month];
- rv += " " + year;
-
- return rv;
- }
-
- date = new Date(date);
-
- const fmtString = "%wkday%, %date1% %time% GMT";
- var rv = fmtString.replace("%wkday%", wkdayStrings[date.getUTCDay()]);
- rv = rv.replace("%time%", toTime(date));
- return rv.replace("%date1%", toDate1(date));
-}
-
-/**
- * Prints out a human-readable representation of the object o and its fields,
- * omitting those whose names begin with "_" if showMembers != true (to ignore
- * "private" properties exposed via getters/setters).
- */
-function printObj(o, showMembers)
-{
- var s = "******************************\n";
- s += "o = {\n";
- for (var i in o)
- {
- if (typeof(i) != "string" ||
- (showMembers || (i.length > 0 && i[0] != "_")))
- s+= " " + i + ": " + o[i] + ",\n";
- }
- s += " };\n";
- s += "******************************";
- dumpn(s);
-}
-
-/**
- * Instantiates a new HTTP server.
- */
-function nsHttpServer()
-{
- if (!gThreadManager)
- gThreadManager = Cc["@mozilla.org/thread-manager;1"].getService();
-
- /** The port on which this server listens. */
- this._port = undefined;
-
- /** The socket associated with this. */
- this._socket = null;
-
- /** The handler used to process requests to this server. */
- this._handler = new ServerHandler(this);
-
- /** Naming information for this server. */
- this._identity = new ServerIdentity();
-
- /**
- * Indicates when the server is to be shut down at the end of the request.
- */
- this._doQuit = false;
-
- /**
- * True if the socket in this is closed (and closure notifications have been
- * sent and processed if the socket was ever opened), false otherwise.
- */
- this._socketClosed = true;
-
- /**
- * Used for tracking existing connections and ensuring that all connections
- * are properly cleaned up before server shutdown; increases by 1 for every
- * new incoming connection.
- */
- this._connectionGen = 0;
-
- /**
- * Hash of all open connections, indexed by connection number at time of
- * creation.
- */
- this._connections = {};
-}
-nsHttpServer.prototype =
-{
- classID: Components.ID("{54ef6f81-30af-4b1d-ac55-8ba811293e41}"),
-
- // NSISERVERSOCKETLISTENER
-
- /**
- * Processes an incoming request coming in on the given socket and contained
- * in the given transport.
- *
- * @param socket : nsIServerSocket
- * the socket through which the request was served
- * @param trans : nsISocketTransport
- * the transport for the request/response
- * @see nsIServerSocketListener.onSocketAccepted
- */
- onSocketAccepted: function(socket, trans)
- {
- dumpn("*** onSocketAccepted(socket=" + socket + ", trans=" + trans + ")");
-
- dumpn(">>> new connection on " + trans.host + ":" + trans.port);
-
- const SEGMENT_SIZE = 8192;
- const SEGMENT_COUNT = 1024;
- try
- {
- var input = trans.openInputStream(0, SEGMENT_SIZE, SEGMENT_COUNT)
- .QueryInterface(Ci.nsIAsyncInputStream);
- var output = trans.openOutputStream(0, 0, 0);
- }
- catch (e)
- {
- dumpn("*** error opening transport streams: " + e);
- trans.close(Cr.NS_BINDING_ABORTED);
- return;
- }
-
- var connectionNumber = ++this._connectionGen;
-
- try
- {
- var conn = new Connection(input, output, this, socket.port, trans.port,
- connectionNumber);
- var reader = new RequestReader(conn);
-
- // XXX add request timeout functionality here!
-
- // Note: must use main thread here, or we might get a GC that will cause
- // threadsafety assertions. We really need to fix XPConnect so that
- // you can actually do things in multi-threaded JS. :-(
- input.asyncWait(reader, 0, 0, gThreadManager.mainThread);
- }
- catch (e)
- {
- // Assume this connection can't be salvaged and bail on it completely;
- // don't attempt to close it so that we can assert that any connection
- // being closed is in this._connections.
- dumpn("*** error in initial request-processing stages: " + e);
- trans.close(Cr.NS_BINDING_ABORTED);
- return;
- }
-
- this._connections[connectionNumber] = conn;
- dumpn("*** starting connection " + connectionNumber);
- },
-
- /**
- * Called when the socket associated with this is closed.
- *
- * @param socket : nsIServerSocket
- * the socket being closed
- * @param status : nsresult
- * the reason the socket stopped listening (NS_BINDING_ABORTED if the server
- * was stopped using nsIHttpServer.stop)
- * @see nsIServerSocketListener.onStopListening
- */
- onStopListening: function(socket, status)
- {
- dumpn(">>> shutting down server on port " + socket.port);
- this._socketClosed = true;
- if (!this._hasOpenConnections())
- {
- dumpn("*** no open connections, notifying async from onStopListening");
-
- // Notify asynchronously so that any pending teardown in stop() has a
- // chance to run first.
- var self = this;
- var stopEvent =
- {
- run: function()
- {
- dumpn("*** _notifyStopped async callback");
- self._notifyStopped();
- }
- };
- gThreadManager.currentThread
- .dispatch(stopEvent, Ci.nsIThread.DISPATCH_NORMAL);
- }
- },
-
- // NSIHTTPSERVER
-
- //
- // see nsIHttpServer.start
- //
- start: function(port)
- {
- this._start(port, "localhost")
- },
-
- _start: function(port, host)
- {
- if (this._socket)
- throw Cr.NS_ERROR_ALREADY_INITIALIZED;
-
- this._port = port;
- this._doQuit = this._socketClosed = false;
-
- this._host = host;
-
- // The listen queue needs to be long enough to handle
- // network.http.max-connections-per-server concurrent connections,
- // plus a safety margin in case some other process is talking to
- // the server as well.
- var prefs = getRootPrefBranch();
- var maxConnections =
- prefs.getIntPref("network.http.max-connections-per-server") + 5;
-
- try
- {
- var loopback = true;
- if (this._host != "127.0.0.1" && this._host != "localhost") {
- var loopback = false;
- }
-
- var socket = new ServerSocket(this._port,
- loopback, // true = localhost, false = everybody
- maxConnections);
- dumpn(">>> listening on port " + socket.port + ", " + maxConnections +
- " pending connections");
- socket.asyncListen(this);
- this._identity._initialize(port, host, true);
- this._socket = socket;
- }
- catch (e)
- {
- dumpn("!!! could not start server on port " + port + ": " + e);
- throw Cr.NS_ERROR_NOT_AVAILABLE;
- }
- },
-
- //
- // see nsIHttpServer.stop
- //
- stop: function(callback)
- {
- if (!callback)
- throw Cr.NS_ERROR_NULL_POINTER;
- if (!this._socket)
- throw Cr.NS_ERROR_UNEXPECTED;
-
- this._stopCallback = typeof callback === "function"
- ? callback
- : function() { callback.onStopped(); };
-
- dumpn(">>> stopping listening on port " + this._socket.port);
- this._socket.close();
- this._socket = null;
-
- // We can't have this identity any more, and the port on which we're running
- // this server now could be meaningless the next time around.
- this._identity._teardown();
-
- this._doQuit = false;
-
- // socket-close notification and pending request completion happen async
- },
-
- //
- // see nsIHttpServer.registerFile
- //
- registerFile: function(path, file)
- {
- if (file && (!file.exists() || file.isDirectory()))
- throw Cr.NS_ERROR_INVALID_ARG;
-
- this._handler.registerFile(path, file);
- },
-
- //
- // see nsIHttpServer.registerDirectory
- //
- registerDirectory: function(path, directory)
- {
- // XXX true path validation!
- if (path.charAt(0) != "/" ||
- path.charAt(path.length - 1) != "/" ||
- (directory &&
- (!directory.exists() || !directory.isDirectory())))
- throw Cr.NS_ERROR_INVALID_ARG;
-
- // XXX determine behavior of nonexistent /foo/bar when a /foo/bar/ mapping
- // exists!
-
- this._handler.registerDirectory(path, directory);
- },
-
- //
- // see nsIHttpServer.registerPathHandler
- //
- registerPathHandler: function(path, handler)
- {
- this._handler.registerPathHandler(path, handler);
- },
-
- //
- // see nsIHttpServer.registerErrorHandler
- //
- registerErrorHandler: function(code, handler)
- {
- this._handler.registerErrorHandler(code, handler);
- },
-
- //
- // see nsIHttpServer.setIndexHandler
- //
- setIndexHandler: function(handler)
- {
- this._handler.setIndexHandler(handler);
- },
-
- //
- // see nsIHttpServer.registerContentType
- //
- registerContentType: function(ext, type)
- {
- this._handler.registerContentType(ext, type);
- },
-
- //
- // see nsIHttpServer.serverIdentity
- //
- get identity()
- {
- return this._identity;
- },
-
- //
- // see nsIHttpServer.getState
- //
- getState: function(path, k)
- {
- return this._handler._getState(path, k);
- },
-
- //
- // see nsIHttpServer.setState
- //
- setState: function(path, k, v)
- {
- return this._handler._setState(path, k, v);
- },
-
- //
- // see nsIHttpServer.getSharedState
- //
- getSharedState: function(k)
- {
- return this._handler._getSharedState(k);
- },
-
- //
- // see nsIHttpServer.setSharedState
- //
- setSharedState: function(k, v)
- {
- return this._handler._setSharedState(k, v);
- },
-
- //
- // see nsIHttpServer.getObjectState
- //
- getObjectState: function(k)
- {
- return this._handler._getObjectState(k);
- },
-
- //
- // see nsIHttpServer.setObjectState
- //
- setObjectState: function(k, v)
- {
- return this._handler._setObjectState(k, v);
- },
-
-
- // NSISUPPORTS
-
- //
- // see nsISupports.QueryInterface
- //
- QueryInterface: function(iid)
- {
- if (iid.equals(Ci.nsIHttpServer) ||
- iid.equals(Ci.nsIServerSocketListener) ||
- iid.equals(Ci.nsISupports))
- return this;
-
- throw Cr.NS_ERROR_NO_INTERFACE;
- },
-
-
- // NON-XPCOM PUBLIC API
-
- /**
- * Returns true iff this server is not running (and is not in the process of
- * serving any requests still to be processed when the server was last
- * stopped after being run).
- */
- isStopped: function()
- {
- return this._socketClosed && !this._hasOpenConnections();
- },
-
- // PRIVATE IMPLEMENTATION
-
- /** True if this server has any open connections to it, false otherwise. */
- _hasOpenConnections: function()
- {
- //
- // If we have any open connections, they're tracked as numeric properties on
- // |this._connections|. The non-standard __count__ property could be used
- // to check whether there are any properties, but standard-wise, even
- // looking forward to ES5, there's no less ugly yet still O(1) way to do
- // this.
- //
- for (var n in this._connections)
- return true;
- return false;
- },
-
- /** Calls the server-stopped callback provided when stop() was called. */
- _notifyStopped: function()
- {
- NS_ASSERT(this._stopCallback !== null, "double-notifying?");
- NS_ASSERT(!this._hasOpenConnections(), "should be done serving by now");
-
- //
- // NB: We have to grab this now, null out the member, *then* call the
- // callback here, or otherwise the callback could (indirectly) futz with
- // this._stopCallback by starting and immediately stopping this, at
- // which point we'd be nulling out a field we no longer have a right to
- // modify.
- //
- var callback = this._stopCallback;
- this._stopCallback = null;
- try
- {
- callback();
- }
- catch (e)
- {
- // not throwing because this is specified as being usually (but not
- // always) asynchronous
- dump("!!! error running onStopped callback: " + e + "\n");
- }
- },
-
- /**
- * Notifies this server that the given connection has been closed.
- *
- * @param connection : Connection
- * the connection that was closed
- */
- _connectionClosed: function(connection)
- {
- NS_ASSERT(connection.number in this._connections,
- "closing a connection " + this + " that we never added to the " +
- "set of open connections?");
- NS_ASSERT(this._connections[connection.number] === connection,
- "connection number mismatch? " +
- this._connections[connection.number]);
- delete this._connections[connection.number];
-
- // Fire a pending server-stopped notification if it's our responsibility.
- if (!this._hasOpenConnections() && this._socketClosed)
- this._notifyStopped();
- },
-
- /**
- * Requests that the server be shut down when possible.
- */
- _requestQuit: function()
- {
- dumpn(">>> requesting a quit");
- dumpStack();
- this._doQuit = true;
- }
-};
-
-
-//
-// RFC 2396 section 3.2.2:
-//
-// host = hostname | IPv4address
-// hostname = *( domainlabel "." ) toplabel [ "." ]
-// domainlabel = alphanum | alphanum *( alphanum | "-" ) alphanum
-// toplabel = alpha | alpha *( alphanum | "-" ) alphanum
-// IPv4address = 1*digit "." 1*digit "." 1*digit "." 1*digit
-//
-
-const HOST_REGEX =
- new RegExp("^(?:" +
- // *( domainlabel "." )
- "(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)*" +
- // toplabel
- "[a-z](?:[a-z0-9-]*[a-z0-9])?" +
- "|" +
- // IPv4 address
- "\\d+\\.\\d+\\.\\d+\\.\\d+" +
- ")$",
- "i");
-
-
-/**
- * Represents the identity of a server. An identity consists of a set of
- * (scheme, host, port) tuples denoted as locations (allowing a single server to
- * serve multiple sites or to be used behind both HTTP and HTTPS proxies for any
- * host/port). Any incoming request must be to one of these locations, or it
- * will be rejected with an HTTP 400 error. One location, denoted as the
- * primary location, is the location assigned in contexts where a location
- * cannot otherwise be endogenously derived, such as for HTTP/1.0 requests.
- *
- * A single identity may contain at most one location per unique host/port pair;
- * other than that, no restrictions are placed upon what locations may
- * constitute an identity.
- */
-function ServerIdentity()
-{
- /** The scheme of the primary location. */
- this._primaryScheme = "http";
-
- /** The hostname of the primary location. */
- this._primaryHost = "127.0.0.1"
-
- /** The port number of the primary location. */
- this._primaryPort = -1;
-
- /**
- * The current port number for the corresponding server, stored so that a new
- * primary location can always be set if the current one is removed.
- */
- this._defaultPort = -1;
-
- /**
- * Maps hosts to maps of ports to schemes, e.g. the following would represent
- * https://example.com:789/ and http://example.org/:
- *
- * {
- * "xexample.com": { 789: "https" },
- * "xexample.org": { 80: "http" }
- * }
- *
- * Note the "x" prefix on hostnames, which prevents collisions with special
- * JS names like "prototype".
- */
- this._locations = { "xlocalhost": {} };
-}
-ServerIdentity.prototype =
-{
- // NSIHTTPSERVERIDENTITY
-
- //
- // see nsIHttpServerIdentity.primaryScheme
- //
- get primaryScheme()
- {
- if (this._primaryPort === -1)
- throw Cr.NS_ERROR_NOT_INITIALIZED;
- return this._primaryScheme;
- },
-
- //
- // see nsIHttpServerIdentity.primaryHost
- //
- get primaryHost()
- {
- if (this._primaryPort === -1)
- throw Cr.NS_ERROR_NOT_INITIALIZED;
- return this._primaryHost;
- },
-
- //
- // see nsIHttpServerIdentity.primaryPort
- //
- get primaryPort()
- {
- if (this._primaryPort === -1)
- throw Cr.NS_ERROR_NOT_INITIALIZED;
- return this._primaryPort;
- },
-
- //
- // see nsIHttpServerIdentity.add
- //
- add: function(scheme, host, port)
- {
- this._validate(scheme, host, port);
-
- var entry = this._locations["x" + host];
- if (!entry)
- this._locations["x" + host] = entry = {};
-
- entry[port] = scheme;
- },
-
- //
- // see nsIHttpServerIdentity.remove
- //
- remove: function(scheme, host, port)
- {
- this._validate(scheme, host, port);
-
- var entry = this._locations["x" + host];
- if (!entry)
- return false;
-
- var present = port in entry;
- delete entry[port];
-
- if (this._primaryScheme == scheme &&
- this._primaryHost == host &&
- this._primaryPort == port &&
- this._defaultPort !== -1)
- {
- // Always keep at least one identity in existence at any time, unless
- // we're in the process of shutting down (the last condition above).
- this._primaryPort = -1;
- this._initialize(this._defaultPort, host, false);
- }
-
- return present;
- },
-
- //
- // see nsIHttpServerIdentity.has
- //
- has: function(scheme, host, port)
- {
- this._validate(scheme, host, port);
-
- return "x" + host in this._locations &&
- scheme === this._locations["x" + host][port];
- },
-
- //
- // see nsIHttpServerIdentity.has
- //
- getScheme: function(host, port)
- {
- this._validate("http", host, port);
-
- var entry = this._locations["x" + host];
- if (!entry)
- return "";
-
- return entry[port] || "";
- },
-
- //
- // see nsIHttpServerIdentity.setPrimary
- //
- setPrimary: function(scheme, host, port)
- {
- this._validate(scheme, host, port);
-
- this.add(scheme, host, port);
-
- this._primaryScheme = scheme;
- this._primaryHost = host;
- this._primaryPort = port;
- },
-
-
- // NSISUPPORTS
-
- //
- // see nsISupports.QueryInterface
- //
- QueryInterface: function(iid)
- {
- if (iid.equals(Ci.nsIHttpServerIdentity) || iid.equals(Ci.nsISupports))
- return this;
-
- throw Cr.NS_ERROR_NO_INTERFACE;
- },
-
-
- // PRIVATE IMPLEMENTATION
-
- /**
- * Initializes the primary name for the corresponding server, based on the
- * provided port number.
- */
- _initialize: function(port, host, addSecondaryDefault)
- {
- this._host = host;
- if (this._primaryPort !== -1)
- this.add("http", host, port);
- else
- this.setPrimary("http", "localhost", port);
- this._defaultPort = port;
-
- // Only add this if we're being called at server startup
- if (addSecondaryDefault && host != "127.0.0.1")
- this.add("http", "127.0.0.1", port);
- },
-
- /**
- * Called at server shutdown time, unsets the primary location only if it was
- * the default-assigned location and removes the default location from the
- * set of locations used.
- */
- _teardown: function()
- {
- if (this._host != "127.0.0.1") {
- // Not the default primary location, nothing special to do here
- this.remove("http", "127.0.0.1", this._defaultPort);
- }
-
- // This is a *very* tricky bit of reasoning here; make absolutely sure the
- // tests for this code pass before you commit changes to it.
- if (this._primaryScheme == "http" &&
- this._primaryHost == this._host &&
- this._primaryPort == this._defaultPort)
- {
- // Make sure we don't trigger the readding logic in .remove(), then remove
- // the default location.
- var port = this._defaultPort;
- this._defaultPort = -1;
- this.remove("http", this._host, port);
-
- // Ensure a server start triggers the setPrimary() path in ._initialize()
- this._primaryPort = -1;
- }
- else
- {
- // No reason not to remove directly as it's not our primary location
- this.remove("http", this._host, this._defaultPort);
- }
- },
-
- /**
- * Ensures scheme, host, and port are all valid with respect to RFC 2396.
- *
- * @throws NS_ERROR_ILLEGAL_VALUE
- * if any argument doesn't match the corresponding production
- */
- _validate: function(scheme, host, port)
- {
- if (scheme !== "http" && scheme !== "https")
- {
- dumpn("*** server only supports http/https schemes: '" + scheme + "'");
- dumpStack();
- throw Cr.NS_ERROR_ILLEGAL_VALUE;
- }
- if (!HOST_REGEX.test(host))
- {
- dumpn("*** unexpected host: '" + host + "'");
- throw Cr.NS_ERROR_ILLEGAL_VALUE;
- }
- if (port < 0 || port > 65535)
- {
- dumpn("*** unexpected port: '" + port + "'");
- throw Cr.NS_ERROR_ILLEGAL_VALUE;
- }
- }
-};
-
-
-/**
- * Represents a connection to the server (and possibly in the future the thread
- * on which the connection is processed).
- *
- * @param input : nsIInputStream
- * stream from which incoming data on the connection is read
- * @param output : nsIOutputStream
- * stream to write data out the connection
- * @param server : nsHttpServer
- * the server handling the connection
- * @param port : int
- * the port on which the server is running
- * @param outgoingPort : int
- * the outgoing port used by this connection
- * @param number : uint
- * a serial number used to uniquely identify this connection
- */
-function Connection(input, output, server, port, outgoingPort, number)
-{
- dumpn("*** opening new connection " + number + " on port " + outgoingPort);
-
- /** Stream of incoming data. */
- this.input = input;
-
- /** Stream for outgoing data. */
- this.output = output;
-
- /** The server associated with this request. */
- this.server = server;
-
- /** The port on which the server is running. */
- this.port = port;
-
- /** The outgoing poort used by this connection. */
- this._outgoingPort = outgoingPort;
-
- /** The serial number of this connection. */
- this.number = number;
-
- /**
- * The request for which a response is being generated, null if the
- * incoming request has not been fully received or if it had errors.
- */
- this.request = null;
-
- /** State variables for debugging. */
- this._closed = this._processed = false;
-}
-Connection.prototype =
-{
- /** Closes this connection's input/output streams. */
- close: function()
- {
- dumpn("*** closing connection " + this.number +
- " on port " + this._outgoingPort);
-
- this.input.close();
- this.output.close();
- this._closed = true;
-
- var server = this.server;
- server._connectionClosed(this);
-
- // If an error triggered a server shutdown, act on it now
- if (server._doQuit)
- server.stop(function() { /* not like we can do anything better */ });
- },
-
- /**
- * Initiates processing of this connection, using the data in the given
- * request.
- *
- * @param request : Request
- * the request which should be processed
- */
- process: function(request)
- {
- NS_ASSERT(!this._closed && !this._processed);
-
- this._processed = true;
-
- this.request = request;
- this.server._handler.handleResponse(this);
- },
-
- /**
- * Initiates processing of this connection, generating a response with the
- * given HTTP error code.
- *
- * @param code : uint
- * an HTTP code, so in the range [0, 1000)
- * @param request : Request
- * incomplete data about the incoming request (since there were errors
- * during its processing
- */
- processError: function(code, request)
- {
- NS_ASSERT(!this._closed && !this._processed);
-
- this._processed = true;
- this.request = request;
- this.server._handler.handleError(code, this);
- },
-
- /** Converts this to a string for debugging purposes. */
- toString: function()
- {
- return "<Connection(" + this.number +
- (this.request ? ", " + this.request.path : "") +"): " +
- (this._closed ? "closed" : "open") + ">";
- }
-};
-
-
-
-/** Returns an array of count bytes from the given input stream. */
-function readBytes(inputStream, count)
-{
- return new BinaryInputStream(inputStream).readByteArray(count);
-}
-
-
-
-/** Request reader processing states; see RequestReader for details. */
-const READER_IN_REQUEST_LINE = 0;
-const READER_IN_HEADERS = 1;
-const READER_IN_BODY = 2;
-const READER_FINISHED = 3;
-
-
-/**
- * Reads incoming request data asynchronously, does any necessary preprocessing,
- * and forwards it to the request handler. Processing occurs in three states:
- *
- * READER_IN_REQUEST_LINE Reading the request's status line
- * READER_IN_HEADERS Reading headers in the request
- * READER_IN_BODY Reading the body of the request
- * READER_FINISHED Entire request has been read and processed
- *
- * During the first two stages, initial metadata about the request is gathered
- * into a Request object. Once the status line and headers have been processed,
- * we start processing the body of the request into the Request. Finally, when
- * the entire body has been read, we create a Response and hand it off to the
- * ServerHandler to be given to the appropriate request handler.
- *
- * @param connection : Connection
- * the connection for the request being read
- */
-function RequestReader(connection)
-{
- /** Connection metadata for this request. */
- this._connection = connection;
-
- /**
- * A container providing line-by-line access to the raw bytes that make up the
- * data which has been read from the connection but has not yet been acted
- * upon (by passing it to the request handler or by extracting request
- * metadata from it).
- */
- this._data = new LineData();
-
- /**
- * The amount of data remaining to be read from the body of this request.
- * After all headers in the request have been read this is the value in the
- * Content-Length header, but as the body is read its value decreases to zero.
- */
- this._contentLength = 0;
-
- /** The current state of parsing the incoming request. */
- this._state = READER_IN_REQUEST_LINE;
-
- /** Metadata constructed from the incoming request for the request handler. */
- this._metadata = new Request(connection.port);
-
- /**
- * Used to preserve state if we run out of line data midway through a
- * multi-line header. _lastHeaderName stores the name of the header, while
- * _lastHeaderValue stores the value we've seen so far for the header.
- *
- * These fields are always either both undefined or both strings.
- */
- this._lastHeaderName = this._lastHeaderValue = undefined;
-}
-RequestReader.prototype =
-{
- // NSIINPUTSTREAMCALLBACK
-
- /**
- * Called when more data from the incoming request is available. This method
- * then reads the available data from input and deals with that data as
- * necessary, depending upon the syntax of already-downloaded data.
- *
- * @param input : nsIAsyncInputStream
- * the stream of incoming data from the connection
- */
- onInputStreamReady: function(input)
- {
- dumpn("*** onInputStreamReady(input=" + input + ") on thread " +
- gThreadManager.currentThread + " (main is " +
- gThreadManager.mainThread + ")");
- dumpn("*** this._state == " + this._state);
-
- // Handle cases where we get more data after a request error has been
- // discovered but *before* we can close the connection.
- var data = this._data;
- if (!data)
- return;
-
- try
- {
- data.appendBytes(readBytes(input, input.available()));
- }
- catch (e)
- {
- if (streamClosed(e))
- {
- dumpn("*** WARNING: unexpected error when reading from socket; will " +
- "be treated as if the input stream had been closed");
- dumpn("*** WARNING: actual error was: " + e);
- }
-
- // We've lost a race -- input has been closed, but we're still expecting
- // to read more data. available() will throw in this case, and since
- // we're dead in the water now, destroy the connection.
- dumpn("*** onInputStreamReady called on a closed input, destroying " +
- "connection");
- this._connection.close();
- return;
- }
-
- switch (this._state)
- {
- default:
- NS_ASSERT(false, "invalid state: " + this._state);
- break;
-
- case READER_IN_REQUEST_LINE:
- if (!this._processRequestLine())
- break;
- /* fall through */
-
- case READER_IN_HEADERS:
- if (!this._processHeaders())
- break;
- /* fall through */
-
- case READER_IN_BODY:
- this._processBody();
- }
-
- if (this._state != READER_FINISHED)
- input.asyncWait(this, 0, 0, gThreadManager.currentThread);
- },
-
- //
- // see nsISupports.QueryInterface
- //
- QueryInterface: function(aIID)
- {
- if (aIID.equals(Ci.nsIInputStreamCallback) ||
- aIID.equals(Ci.nsISupports))
- return this;
-
- throw Cr.NS_ERROR_NO_INTERFACE;
- },
-
-
- // PRIVATE API
-
- /**
- * Processes unprocessed, downloaded data as a request line.
- *
- * @returns boolean
- * true iff the request line has been fully processed
- */
- _processRequestLine: function()
- {
- NS_ASSERT(this._state == READER_IN_REQUEST_LINE);
-
- // Servers SHOULD ignore any empty line(s) received where a Request-Line
- // is expected (section 4.1).
- var data = this._data;
- var line = {};
- var readSuccess;
- while ((readSuccess = data.readLine(line)) && line.value == "")
- dumpn("*** ignoring beginning blank line...");
-
- // if we don't have a full line, wait until we do
- if (!readSuccess)
- return false;
-
- // we have the first non-blank line
- try
- {
- this._parseRequestLine(line.value);
- this._state = READER_IN_HEADERS;
- return true;
- }
- catch (e)
- {
- this._handleError(e);
- return false;
- }
- },
-
- /**
- * Processes stored data, assuming it is either at the beginning or in
- * the middle of processing request headers.
- *
- * @returns boolean
- * true iff header data in the request has been fully processed
- */
- _processHeaders: function()
- {
- NS_ASSERT(this._state == READER_IN_HEADERS);
-
- // XXX things to fix here:
- //
- // - need to support RFC 2047-encoded non-US-ASCII characters
-
- try
- {
- var done = this._parseHeaders();
- if (done)
- {
- var request = this._metadata;
-
- // XXX this is wrong for requests with transfer-encodings applied to
- // them, particularly chunked (which by its nature can have no
- // meaningful Content-Length header)!
- this._contentLength = request.hasHeader("Content-Length")
- ? parseInt(request.getHeader("Content-Length"), 10)
- : 0;
- dumpn("_processHeaders, Content-length=" + this._contentLength);
-
- this._state = READER_IN_BODY;
- }
- return done;
- }
- catch (e)
- {
- this._handleError(e);
- return false;
- }
- },
-
- /**
- * Processes stored data, assuming it is either at the beginning or in
- * the middle of processing the request body.
- *
- * @returns boolean
- * true iff the request body has been fully processed
- */
- _processBody: function()
- {
- NS_ASSERT(this._state == READER_IN_BODY);
-
- // XXX handle chunked transfer-coding request bodies!
-
- try
- {
- if (this._contentLength > 0)
- {
- var data = this._data.purge();
- var count = Math.min(data.length, this._contentLength);
- dumpn("*** loading data=" + data + " len=" + data.length +
- " excess=" + (data.length - count));
-
- var bos = new BinaryOutputStream(this._metadata._bodyOutputStream);
- bos.writeByteArray(data, count);
- this._contentLength -= count;
- }
-
- dumpn("*** remaining body data len=" + this._contentLength);
- if (this._contentLength == 0)
- {
- this._validateRequest();
- this._state = READER_FINISHED;
- this._handleResponse();
- return true;
- }
-
- return false;
- }
- catch (e)
- {
- this._handleError(e);
- return false;
- }
- },
-
- /**
- * Does various post-header checks on the data in this request.
- *
- * @throws : HttpError
- * if the request was malformed in some way
- */
- _validateRequest: function()
- {
- NS_ASSERT(this._state == READER_IN_BODY);
-
- dumpn("*** _validateRequest");
-
- var metadata = this._metadata;
- var headers = metadata._headers;
-
- // 19.6.1.1 -- servers MUST report 400 to HTTP/1.1 requests w/o Host header
- var identity = this._connection.server.identity;
- if (metadata._httpVersion.atLeast(nsHttpVersion.HTTP_1_1))
- {
- if (!headers.hasHeader("Host"))
- {
- dumpn("*** malformed HTTP/1.1 or greater request with no Host header!");
- throw HTTP_400;
- }
-
- // If the Request-URI wasn't absolute, then we need to determine our host.
- // We have to determine what scheme was used to access us based on the
- // server identity data at this point, because the request just doesn't
- // contain enough data on its own to do this, sadly.
- if (!metadata._host)
- {
- var host, port;
- var hostPort = headers.getHeader("Host");
- var colon = hostPort.indexOf(":");
- if (colon < 0)
- {
- host = hostPort;
- port = "";
- }
- else
- {
- host = hostPort.substring(0, colon);
- port = hostPort.substring(colon + 1);
- }
-
- // NB: We allow an empty port here because, oddly, a colon may be
- // present even without a port number, e.g. "example.com:"; in this
- // case the default port applies.
- if (!HOST_REGEX.test(host) || !/^\d*$/.test(port))
- {
- dumpn("*** malformed hostname (" + hostPort + ") in Host " +
- "header, 400 time");
- throw HTTP_400;
- }
-
- // If we're not given a port, we're stuck, because we don't know what
- // scheme to use to look up the correct port here, in general. Since
- // the HTTPS case requires a tunnel/proxy and thus requires that the
- // requested URI be absolute (and thus contain the necessary
- // information), let's assume HTTP will prevail and use that.
- port = +port || 80;
-
- var scheme = identity.getScheme(host, port);
- if (!scheme)
- {
- dumpn("*** unrecognized hostname (" + hostPort + ") in Host " +
- "header, 400 time");
- throw HTTP_400;
- }
-
- metadata._scheme = scheme;
- metadata._host = host;
- metadata._port = port;
- }
- }
- else
- {
- NS_ASSERT(metadata._host === undefined,
- "HTTP/1.0 doesn't allow absolute paths in the request line!");
-
- metadata._scheme = identity.primaryScheme;
- metadata._host = identity.primaryHost;
- metadata._port = identity.primaryPort;
- }
-
- NS_ASSERT(identity.has(metadata._scheme, metadata._host, metadata._port),
- "must have a location we recognize by now!");
- },
-
- /**
- * Handles responses in case of error, either in the server or in the request.
- *
- * @param e
- * the specific error encountered, which is an HttpError in the case where
- * the request is in some way invalid or cannot be fulfilled; if this isn't
- * an HttpError we're going to be paranoid and shut down, because that
- * shouldn't happen, ever
- */
- _handleError: function(e)
- {
- // Don't fall back into normal processing!
- this._state = READER_FINISHED;
-
- var server = this._connection.server;
- if (e instanceof HttpError)
- {
- var code = e.code;
- }
- else
- {
- dumpn("!!! UNEXPECTED ERROR: " + e +
- (e.lineNumber ? ", line " + e.lineNumber : ""));
-
- // no idea what happened -- be paranoid and shut down
- code = 500;
- server._requestQuit();
- }
-
- // make attempted reuse of data an error
- this._data = null;
-
- this._connection.processError(code, this._metadata);
- },
-
- /**
- * Now that we've read the request line and headers, we can actually hand off
- * the request to be handled.
- *
- * This method is called once per request, after the request line and all
- * headers and the body, if any, have been received.
- */
- _handleResponse: function()
- {
- NS_ASSERT(this._state == READER_FINISHED);
-
- // We don't need the line-based data any more, so make attempted reuse an
- // error.
- this._data = null;
-
- this._connection.process(this._metadata);
- },
-
-
- // PARSING
-
- /**
- * Parses the request line for the HTTP request associated with this.
- *
- * @param line : string
- * the request line
- */
- _parseRequestLine: function(line)
- {
- NS_ASSERT(this._state == READER_IN_REQUEST_LINE);
-
- dumpn("*** _parseRequestLine('" + line + "')");
-
- var metadata = this._metadata;
-
- // clients and servers SHOULD accept any amount of SP or HT characters
- // between fields, even though only a single SP is required (section 19.3)
- var request = line.split(/[ \t]+/);
- if (!request || request.length != 3)
- throw HTTP_400;
-
- metadata._method = request[0];
-
- // get the HTTP version
- var ver = request[2];
- var match = ver.match(/^HTTP\/(\d+\.\d+)$/);
- if (!match)
- throw HTTP_400;
-
- // determine HTTP version
- try
- {
- metadata._httpVersion = new nsHttpVersion(match[1]);
- if (!metadata._httpVersion.atLeast(nsHttpVersion.HTTP_1_0))
- throw "unsupported HTTP version";
- }
- catch (e)
- {
- // we support HTTP/1.0 and HTTP/1.1 only
- throw HTTP_501;
- }
-
-
- var fullPath = request[1];
- var serverIdentity = this._connection.server.identity;
-
- var scheme, host, port;
-
- if (fullPath.charAt(0) != "/")
- {
- // No absolute paths in the request line in HTTP prior to 1.1
- if (!metadata._httpVersion.atLeast(nsHttpVersion.HTTP_1_1))
- throw HTTP_400;
-
- try
- {
- var uri = Cc["@mozilla.org/network/io-service;1"]
- .getService(Ci.nsIIOService)
- .newURI(fullPath, null, null);
- fullPath = uri.path;
- scheme = uri.scheme;
- host = metadata._host = uri.asciiHost;
- port = uri.port;
- if (port === -1)
- {
- if (scheme === "http")
- port = 80;
- else if (scheme === "https")
- port = 443;
- else
- throw HTTP_400;
- }
- }
- catch (e)
- {
- // If the host is not a valid host on the server, the response MUST be a
- // 400 (Bad Request) error message (section 5.2). Alternately, the URI
- // is malformed.
- throw HTTP_400;
- }
-
- if (!serverIdentity.has(scheme, host, port) || fullPath.charAt(0) != "/")
- throw HTTP_400;
- }
-
- var splitter = fullPath.indexOf("?");
- if (splitter < 0)
- {
- // _queryString already set in ctor
- metadata._path = fullPath;
- }
- else
- {
- metadata._path = fullPath.substring(0, splitter);
- metadata._queryString = fullPath.substring(splitter + 1);
- }
-
- metadata._scheme = scheme;
- metadata._host = host;
- metadata._port = port;
- },
-
- /**
- * Parses all available HTTP headers in this until the header-ending CRLFCRLF,
- * adding them to the store of headers in the request.
- *
- * @throws
- * HTTP_400 if the headers are malformed
- * @returns boolean
- * true if all headers have now been processed, false otherwise
- */
- _parseHeaders: function()
- {
- NS_ASSERT(this._state == READER_IN_HEADERS);
-
- dumpn("*** _parseHeaders");
-
- var data = this._data;
-
- var headers = this._metadata._headers;
- var lastName = this._lastHeaderName;
- var lastVal = this._lastHeaderValue;
-
- var line = {};
- while (true)
- {
- NS_ASSERT(!((lastVal === undefined) ^ (lastName === undefined)),
- lastName === undefined ?
- "lastVal without lastName? lastVal: '" + lastVal + "'" :
- "lastName without lastVal? lastName: '" + lastName + "'");
-
- if (!data.readLine(line))
- {
- // save any data we have from the header we might still be processing
- this._lastHeaderName = lastName;
- this._lastHeaderValue = lastVal;
- return false;
- }
-
- var lineText = line.value;
- var firstChar = lineText.charAt(0);
-
- // blank line means end of headers
- if (lineText == "")
- {
- // we're finished with the previous header
- if (lastName)
- {
- try
- {
- headers.setHeader(lastName, lastVal, true);
- }
- catch (e)
- {
- dumpn("*** e == " + e);
- throw HTTP_400;
- }
- }
- else
- {
- // no headers in request -- valid for HTTP/1.0 requests
- }
-
- // either way, we're done processing headers
- this._state = READER_IN_BODY;
- return true;
- }
- else if (firstChar == " " || firstChar == "\t")
- {
- // multi-line header if we've already seen a header line
- if (!lastName)
- {
- // we don't have a header to continue!
- throw HTTP_400;
- }
-
- // append this line's text to the value; starts with SP/HT, so no need
- // for separating whitespace
- lastVal += lineText;
- }
- else
- {
- // we have a new header, so set the old one (if one existed)
- if (lastName)
- {
- try
- {
- headers.setHeader(lastName, lastVal, true);
- }
- catch (e)
- {
- dumpn("*** e == " + e);
- throw HTTP_400;
- }
- }
-
- var colon = lineText.indexOf(":"); // first colon must be splitter
- if (colon < 1)
- {
- // no colon or missing header field-name
- throw HTTP_400;
- }
-
- // set header name, value (to be set in the next loop, usually)
- lastName = lineText.substring(0, colon);
- lastVal = lineText.substring(colon + 1);
- } // empty, continuation, start of header
- } // while (true)
- }
-};
-
-
-/** The character codes for CR and LF. */
-const CR = 0x0D, LF = 0x0A;
-
-/**
- * Calculates the number of characters before the first CRLF pair in array, or
- * -1 if the array contains no CRLF pair.
- *
- * @param array : Array
- * an array of numbers in the range [0, 256), each representing a single
- * character; the first CRLF is the lowest index i where
- * |array[i] == "\r".charCodeAt(0)| and |array[i+1] == "\n".charCodeAt(0)|,
- * if such an |i| exists, and -1 otherwise
- * @returns int
- * the index of the first CRLF if any were present, -1 otherwise
- */
-function findCRLF(array)
-{
- for (var i = array.indexOf(CR); i >= 0; i = array.indexOf(CR, i + 1))
- {
- if (array[i + 1] == LF)
- return i;
- }
- return -1;
-}
-
-
-/**
- * A container which provides line-by-line access to the arrays of bytes with
- * which it is seeded.
- */
-function LineData()
-{
- /** An array of queued bytes from which to get line-based characters. */
- this._data = [];
-}
-LineData.prototype =
-{
- /**
- * Appends the bytes in the given array to the internal data cache maintained
- * by this.
- */
- appendBytes: function(bytes)
- {
- Array.prototype.push.apply(this._data, bytes);
- },
-
- /**
- * Removes and returns a line of data, delimited by CRLF, from this.
- *
- * @param out
- * an object whose "value" property will be set to the first line of text
- * present in this, sans CRLF, if this contains a full CRLF-delimited line
- * of text; if this doesn't contain enough data, the value of the property
- * is undefined
- * @returns boolean
- * true if a full line of data could be read from the data in this, false
- * otherwise
- */
- readLine: function(out)
- {
- var data = this._data;
- var length = findCRLF(data);
- if (length < 0)
- return false;
-
- //
- // We have the index of the CR, so remove all the characters, including
- // CRLF, from the array with splice, and convert the removed array into the
- // corresponding string, from which we then strip the trailing CRLF.
- //
- // Getting the line in this matter acknowledges that substring is an O(1)
- // operation in SpiderMonkey because strings are immutable, whereas two
- // splices, both from the beginning of the data, are less likely to be as
- // cheap as a single splice plus two extra character conversions.
- //
- var line = String.fromCharCode.apply(null, data.splice(0, length + 2));
- out.value = line.substring(0, length);
-
- return true;
- },
-
- /**
- * Removes the bytes currently within this and returns them in an array.
- *
- * @returns Array
- * the bytes within this when this method is called
- */
- purge: function()
- {
- var data = this._data;
- this._data = [];
- return data;
- }
-};
-
-
-
-/**
- * Creates a request-handling function for an nsIHttpRequestHandler object.
- */
-function createHandlerFunc(handler)
-{
- return function(metadata, response) { handler.handle(metadata, response); };
-}
-
-
-/**
- * The default handler for directories; writes an HTML response containing a
- * slightly-formatted directory listing.
- */
-function defaultIndexHandler(metadata, response)
-{
- response.setHeader("Content-Type", "text/html", false);
-
- var path = htmlEscape(decodeURI(metadata.path));
-
- //
- // Just do a very basic bit of directory listings -- no need for too much
- // fanciness, especially since we don't have a style sheet in which we can
- // stick rules (don't want to pollute the default path-space).
- //
-
- var body = '<html>\
- <head>\
- <title>' + path + '</title>\
- </head>\
- <body>\
- <h1>' + path + '</h1>\
- <ol style="list-style-type: none">';
-
- var directory = metadata.getProperty("directory");
- NS_ASSERT(directory && directory.isDirectory());
-
- var fileList = [];
- var files = directory.directoryEntries;
- while (files.hasMoreElements())
- {
- var f = files.getNext().QueryInterface(Ci.nsIFile);
- var name = f.leafName;
- if (!f.isHidden() &&
- (name.charAt(name.length - 1) != HIDDEN_CHAR ||
- name.charAt(name.length - 2) == HIDDEN_CHAR))
- fileList.push(f);
- }
-
- fileList.sort(fileSort);
-
- for (var i = 0; i < fileList.length; i++)
- {
- var file = fileList[i];
- try
- {
- var name = file.leafName;
- if (name.charAt(name.length - 1) == HIDDEN_CHAR)
- name = name.substring(0, name.length - 1);
- var sep = file.isDirectory() ? "/" : "";
-
- // Note: using " to delimit the attribute here because encodeURIComponent
- // passes through '.
- var item = '<li><a href="' + encodeURIComponent(name) + sep + '">' +
- htmlEscape(name) + sep +
- '</a></li>';
-
- body += item;
- }
- catch (e) { /* some file system error, ignore the file */ }
- }
-
- body += ' </ol>\
- </body>\
- </html>';
-
- response.bodyOutputStream.write(body, body.length);
-}
-
-/**
- * Sorts a and b (nsIFile objects) into an aesthetically pleasing order.
- */
-function fileSort(a, b)
-{
- var dira = a.isDirectory(), dirb = b.isDirectory();
-
- if (dira && !dirb)
- return -1;
- if (dirb && !dira)
- return 1;
-
- var namea = a.leafName.toLowerCase(), nameb = b.leafName.toLowerCase();
- return nameb > namea ? -1 : 1;
-}
-
-
-/**
- * Converts an externally-provided path into an internal path for use in
- * determining file mappings.
- *
- * @param path
- * the path to convert
- * @param encoded
- * true if the given path should be passed through decodeURI prior to
- * conversion
- * @throws URIError
- * if path is incorrectly encoded
- */
-function toInternalPath(path, encoded)
-{
- if (encoded)
- path = decodeURI(path);
-
- var comps = path.split("/");
- for (var i = 0, sz = comps.length; i < sz; i++)
- {
- var comp = comps[i];
- if (comp.charAt(comp.length - 1) == HIDDEN_CHAR)
- comps[i] = comp + HIDDEN_CHAR;
- }
- return comps.join("/");
-}
-
-
-/**
- * Adds custom-specified headers for the given file to the given response, if
- * any such headers are specified.
- *
- * @param file
- * the file on the disk which is to be written
- * @param metadata
- * metadata about the incoming request
- * @param response
- * the Response to which any specified headers/data should be written
- * @throws HTTP_500
- * if an error occurred while processing custom-specified headers
- */
-function maybeAddHeaders(file, metadata, response)
-{
- var name = file.leafName;
- if (name.charAt(name.length - 1) == HIDDEN_CHAR)
- name = name.substring(0, name.length - 1);
-
- var headerFile = file.parent;
- headerFile.append(name + HEADERS_SUFFIX);
-
- if (!headerFile.exists())
- return;
-
- const PR_RDONLY = 0x01;
- var fis = new FileInputStream(headerFile, PR_RDONLY, 0444,
- Ci.nsIFileInputStream.CLOSE_ON_EOF);
-
- try
- {
- var lis = new ConverterInputStream(fis, "UTF-8", 1024, 0x0);
- lis.QueryInterface(Ci.nsIUnicharLineInputStream);
-
- var line = {value: ""};
- var more = lis.readLine(line);
-
- if (!more && line.value == "")
- return;
-
-
- // request line
-
- var status = line.value;
- if (status.indexOf("HTTP ") == 0)
- {
- status = status.substring(5);
- var space = status.indexOf(" ");
- var code, description;
- if (space < 0)
- {
- code = status;
- description = "";
- }
- else
- {
- code = status.substring(0, space);
- description = status.substring(space + 1, status.length);
- }
-
- response.setStatusLine(metadata.httpVersion, parseInt(code, 10), description);
-
- line.value = "";
- more = lis.readLine(line);
- }
-
- // headers
- while (more || line.value != "")
- {
- var header = line.value;
- var colon = header.indexOf(":");
-
- response.setHeader(header.substring(0, colon),
- header.substring(colon + 1, header.length),
- false); // allow overriding server-set headers
-
- line.value = "";
- more = lis.readLine(line);
- }
- }
- catch (e)
- {
- dumpn("WARNING: error in headers for " + metadata.path + ": " + e);
- throw HTTP_500;
- }
- finally
- {
- fis.close();
- }
-}
-
-
-/**
- * An object which handles requests for a server, executing default and
- * overridden behaviors as instructed by the code which uses and manipulates it.
- * Default behavior includes the paths / and /trace (diagnostics), with some
- * support for HTTP error pages for various codes and fallback to HTTP 500 if
- * those codes fail for any reason.
- *
- * @param server : nsHttpServer
- * the server in which this handler is being used
- */
-function ServerHandler(server)
-{
- // FIELDS
-
- /**
- * The nsHttpServer instance associated with this handler.
- */
- this._server = server;
-
- /**
- * A FileMap object containing the set of path->nsILocalFile mappings for
- * all directory mappings set in the server (e.g., "/" for /var/www/html/,
- * "/foo/bar/" for /local/path/, and "/foo/bar/baz/" for /local/path2).
- *
- * Note carefully: the leading and trailing "/" in each path (not file) are
- * removed before insertion to simplify the code which uses this. You have
- * been warned!
- */
- this._pathDirectoryMap = new FileMap();
-
- /**
- * Custom request handlers for the server in which this resides. Path-handler
- * pairs are stored as property-value pairs in this property.
- *
- * @see ServerHandler.prototype._defaultPaths
- */
- this._overridePaths = {};
-
- /**
- * Custom request handlers for the error handlers in the server in which this
- * resides. Path-handler pairs are stored as property-value pairs in this
- * property.
- *
- * @see ServerHandler.prototype._defaultErrors
- */
- this._overrideErrors = {};
-
- /**
- * Maps file extensions to their MIME types in the server, overriding any
- * mapping that might or might not exist in the MIME service.
- */
- this._mimeMappings = {};
-
- /**
- * The default handler for requests for directories, used to serve directories
- * when no index file is present.
- */
- this._indexHandler = defaultIndexHandler;
-
- /** Per-path state storage for the server. */
- this._state = {};
-
- /** Entire-server state storage. */
- this._sharedState = {};
-
- /** Entire-server state storage for nsISupports values. */
- this._objectState = {};
-}
-ServerHandler.prototype =
-{
- // PUBLIC API
-
- /**
- * Handles a request to this server, responding to the request appropriately
- * and initiating server shutdown if necessary.
- *
- * This method never throws an exception.
- *
- * @param connection : Connection
- * the connection for this request
- */
- handleResponse: function(connection)
- {
- var request = connection.request;
- var response = new Response(connection);
-
- var path = request.path;
- dumpn("*** path == " + path);
-
- try
- {
- try
- {
- if (path in this._overridePaths)
- {
- // explicit paths first, then files based on existing directory mappings,
- // then (if the file doesn't exist) built-in server default paths
- dumpn("calling override for " + path);
- this._overridePaths[path](request, response);
- }
- else
- {
- this._handleDefault(request, response);
- }
- }
- catch (e)
- {
- if (response.partiallySent())
- {
- response.abort(e);
- return;
- }
-
- if (!(e instanceof HttpError))
- {
- dumpn("*** unexpected error: e == " + e);
- throw HTTP_500;
- }
- if (e.code !== 404)
- throw e;
-
- dumpn("*** default: " + (path in this._defaultPaths));
-
- response = new Response(connection);
- if (path in this._defaultPaths)
- this._defaultPaths[path](request, response);
- else
- throw HTTP_404;
- }
- }
- catch (e)
- {
- if (response.partiallySent())
- {
- response.abort(e);
- return;
- }
-
- var errorCode = "internal";
-
- try
- {
- if (!(e instanceof HttpError))
- throw e;
-
- errorCode = e.code;
- dumpn("*** errorCode == " + errorCode);
-
- response = new Response(connection);
- if (e.customErrorHandling)
- e.customErrorHandling(response);
- this._handleError(errorCode, request, response);
- return;
- }
- catch (e2)
- {
- dumpn("*** error handling " + errorCode + " error: " +
- "e2 == " + e2 + ", shutting down server");
-
- connection.server._requestQuit();
- response.abort(e2);
- return;
- }
- }
-
- response.complete();
- },
-
- //
- // see nsIHttpServer.registerFile
- //
- registerFile: function(path, file)
- {
- if (!file)
- {
- dumpn("*** unregistering '" + path + "' mapping");
- delete this._overridePaths[path];
- return;
- }
-
- dumpn("*** registering '" + path + "' as mapping to " + file.path);
- file = file.clone();
-
- var self = this;
- this._overridePaths[path] =
- function(request, response)
- {
- if (!file.exists())
- throw HTTP_404;
-
- response.setStatusLine(request.httpVersion, 200, "OK");
- self._writeFileResponse(request, file, response, 0, file.fileSize);
- };
- },
-
- //
- // see nsIHttpServer.registerPathHandler
- //
- registerPathHandler: function(path, handler)
- {
- // XXX true path validation!
- if (path.charAt(0) != "/")
- throw Cr.NS_ERROR_INVALID_ARG;
-
- this._handlerToField(handler, this._overridePaths, path);
- },
-
- //
- // see nsIHttpServer.registerDirectory
- //
- registerDirectory: function(path, directory)
- {
- // strip off leading and trailing '/' so that we can use lastIndexOf when
- // determining exactly how a path maps onto a mapped directory --
- // conditional is required here to deal with "/".substring(1, 0) being
- // converted to "/".substring(0, 1) per the JS specification
- var key = path.length == 1 ? "" : path.substring(1, path.length - 1);
-
- // the path-to-directory mapping code requires that the first character not
- // be "/", or it will go into an infinite loop
- if (key.charAt(0) == "/")
- throw Cr.NS_ERROR_INVALID_ARG;
-
- key = toInternalPath(key, false);
-
- if (directory)
- {
- dumpn("*** mapping '" + path + "' to the location " + directory.path);
- this._pathDirectoryMap.put(key, directory);
- }
- else
- {
- dumpn("*** removing mapping for '" + path + "'");
- this._pathDirectoryMap.put(key, null);
- }
- },
-
- //
- // see nsIHttpServer.registerErrorHandler
- //
- registerErrorHandler: function(err, handler)
- {
- if (!(err in HTTP_ERROR_CODES))
- dumpn("*** WARNING: registering non-HTTP/1.1 error code " +
- "(" + err + ") handler -- was this intentional?");
-
- this._handlerToField(handler, this._overrideErrors, err);
- },
-
- //
- // see nsIHttpServer.setIndexHandler
- //
- setIndexHandler: function(handler)
- {
- if (!handler)
- handler = defaultIndexHandler;
- else if (typeof(handler) != "function")
- handler = createHandlerFunc(handler);
-
- this._indexHandler = handler;
- },
-
- //
- // see nsIHttpServer.registerContentType
- //
- registerContentType: function(ext, type)
- {
- if (!type)
- delete this._mimeMappings[ext];
- else
- this._mimeMappings[ext] = headerUtils.normalizeFieldValue(type);
- },
-
- // PRIVATE API
-
- /**
- * Sets or remove (if handler is null) a handler in an object with a key.
- *
- * @param handler
- * a handler, either function or an nsIHttpRequestHandler
- * @param dict
- * The object to attach the handler to.
- * @param key
- * The field name of the handler.
- */
- _handlerToField: function(handler, dict, key)
- {
- // for convenience, handler can be a function if this is run from xpcshell
- if (typeof(handler) == "function")
- dict[key] = handler;
- else if (handler)
- dict[key] = createHandlerFunc(handler);
- else
- delete dict[key];
- },
-
- /**
- * Handles a request which maps to a file in the local filesystem (if a base
- * path has already been set; otherwise the 404 error is thrown).
- *
- * @param metadata : Request
- * metadata for the incoming request
- * @param response : Response
- * an uninitialized Response to the given request, to be initialized by a
- * request handler
- * @throws HTTP_###
- * if an HTTP error occurred (usually HTTP_404); note that in this case the
- * calling code must handle post-processing of the response
- */
- _handleDefault: function(metadata, response)
- {
- dumpn("*** _handleDefault()");
-
- response.setStatusLine(metadata.httpVersion, 200, "OK");
-
- var path = metadata.path;
- NS_ASSERT(path.charAt(0) == "/", "invalid path: <" + path + ">");
-
- // determine the actual on-disk file; this requires finding the deepest
- // path-to-directory mapping in the requested URL
- var file = this._getFileForPath(path);
-
- // the "file" might be a directory, in which case we either serve the
- // contained index.html or make the index handler write the response
- if (file.exists() && file.isDirectory())
- {
- file.append("index.html"); // make configurable?
- if (!file.exists() || file.isDirectory())
- {
- metadata._ensurePropertyBag();
- metadata._bag.setPropertyAsInterface("directory", file.parent);
- this._indexHandler(metadata, response);
- return;
- }
- }
-
- // alternately, the file might not exist
- if (!file.exists())
- throw HTTP_404;
-
- var start, end;
- if (metadata._httpVersion.atLeast(nsHttpVersion.HTTP_1_1) &&
- metadata.hasHeader("Range") &&
- this._getTypeFromFile(file) !== SJS_TYPE)
- {
- var rangeMatch = metadata.getHeader("Range").match(/^bytes=(\d+)?-(\d+)?$/);
- if (!rangeMatch)
- throw HTTP_400;
-
- if (rangeMatch[1] !== undefined)
- start = parseInt(rangeMatch[1], 10);
-
- if (rangeMatch[2] !== undefined)
- end = parseInt(rangeMatch[2], 10);
-
- if (start === undefined && end === undefined)
- throw HTTP_400;
-
- // No start given, so the end is really the count of bytes from the
- // end of the file.
- if (start === undefined)
- {
- start = Math.max(0, file.fileSize - end);
- end = file.fileSize - 1;
- }
-
- // start and end are inclusive
- if (end === undefined || end >= file.fileSize)
- end = file.fileSize - 1;
-
- if (start !== undefined && start >= file.fileSize) {
- var HTTP_416 = new HttpError(416, "Requested Range Not Satisfiable");
- HTTP_416.customErrorHandling = function(errorResponse)
- {
- maybeAddHeaders(file, metadata, errorResponse);
- };
- throw HTTP_416;
- }
-
- if (end < start)
- {
- response.setStatusLine(metadata.httpVersion, 200, "OK");
- start = 0;
- end = file.fileSize - 1;
- }
- else
- {
- response.setStatusLine(metadata.httpVersion, 206, "Partial Content");
- var contentRange = "bytes " + start + "-" + end + "/" + file.fileSize;
- response.setHeader("Content-Range", contentRange);
- }
- }
- else
- {
- start = 0;
- end = file.fileSize - 1;
- }
-
- // finally...
- dumpn("*** handling '" + path + "' as mapping to " + file.path + " from " +
- start + " to " + end + " inclusive");
- this._writeFileResponse(metadata, file, response, start, end - start + 1);
- },
-
- /**
- * Writes an HTTP response for the given file, including setting headers for
- * file metadata.
- *
- * @param metadata : Request
- * the Request for which a response is being generated
- * @param file : nsILocalFile
- * the file which is to be sent in the response
- * @param response : Response
- * the response to which the file should be written
- * @param offset: uint
- * the byte offset to skip to when writing
- * @param count: uint
- * the number of bytes to write
- */
- _writeFileResponse: function(metadata, file, response, offset, count)
- {
- const PR_RDONLY = 0x01;
-
- var type = this._getTypeFromFile(file);
- if (type === SJS_TYPE)
- {
- var fis = new FileInputStream(file, PR_RDONLY, 0444,
- Ci.nsIFileInputStream.CLOSE_ON_EOF);
-
- try
- {
- var sis = new ScriptableInputStream(fis);
- var s = Cu.Sandbox(gGlobalObject);
- s.importFunction(dump, "dump");
-
- // Define a basic key-value state-preservation API across requests, with
- // keys initially corresponding to the empty string.
- var self = this;
- var path = metadata.path;
- s.importFunction(function getState(k)
- {
- return self._getState(path, k);
- });
- s.importFunction(function setState(k, v)
- {
- self._setState(path, k, v);
- });
- s.importFunction(function getSharedState(k)
- {
- return self._getSharedState(k);
- });
- s.importFunction(function setSharedState(k, v)
- {
- self._setSharedState(k, v);
- });
- s.importFunction(function getObjectState(k, callback)
- {
- callback(self._getObjectState(k));
- });
- s.importFunction(function setObjectState(k, v)
- {
- self._setObjectState(k, v);
- });
-
- // Make it possible for sjs files to access their location
- this._setState(path, "__LOCATION__", file.path);
-
- try
- {
- // Alas, the line number in errors dumped to console when calling the
- // request handler is simply an offset from where we load the SJS file.
- // Work around this in a reasonably non-fragile way by dynamically
- // getting the line number where we evaluate the SJS file. Don't
- // separate these two lines!
- var line = new Error().lineNumber;
- Cu.evalInSandbox(sis.read(file.fileSize), s);
- }
- catch (e)
- {
- dumpn("*** syntax error in SJS at " + file.path + ": " + e);
- throw HTTP_500;
- }
-
- try
- {
- s.handleRequest(metadata, response);
- }
- catch (e)
- {
- dump("*** error running SJS at " + file.path + ": " +
- e + " on line " +
- (e instanceof Error
- ? e.lineNumber + " in httpd.js"
- : (e.lineNumber - line)) + "\n");
- throw HTTP_500;
- }
- }
- finally
- {
- fis.close();
- }
- }
- else
- {
- try
- {
- response.setHeader("Last-Modified",
- toDateString(file.lastModifiedTime),
- false);
- }
- catch (e) { /* lastModifiedTime threw, ignore */ }
-
- response.setHeader("Content-Type", type, false);
- maybeAddHeaders(file, metadata, response);
- response.setHeader("Content-Length", "" + count, false);
-
- var fis = new FileInputStream(file, PR_RDONLY, 0444,
- Ci.nsIFileInputStream.CLOSE_ON_EOF);
-
- offset = offset || 0;
- count = count || file.fileSize;
- NS_ASSERT(offset === 0 || offset < file.fileSize, "bad offset");
- NS_ASSERT(count >= 0, "bad count");
- NS_ASSERT(offset + count <= file.fileSize, "bad total data size");
-
- try
- {
- if (offset !== 0)
- {
- // Seek (or read, if seeking isn't supported) to the correct offset so
- // the data sent to the client matches the requested range.
- if (fis instanceof Ci.nsISeekableStream)
- fis.seek(Ci.nsISeekableStream.NS_SEEK_SET, offset);
- else
- new ScriptableInputStream(fis).read(offset);
- }
- }
- catch (e)
- {
- fis.close();
- throw e;
- }
-
- function writeMore()
- {
- gThreadManager.currentThread
- .dispatch(writeData, Ci.nsIThread.DISPATCH_NORMAL);
- }
-
- var input = new BinaryInputStream(fis);
- var output = new BinaryOutputStream(response.bodyOutputStream);
- var writeData =
- {
- run: function()
- {
- var chunkSize = Math.min(65536, count);
- count -= chunkSize;
- NS_ASSERT(count >= 0, "underflow");
-
- try
- {
- var data = input.readByteArray(chunkSize);
- NS_ASSERT(data.length === chunkSize,
- "incorrect data returned? got " + data.length +
- ", expected " + chunkSize);
- output.writeByteArray(data, data.length);
- if (count === 0)
- {
- fis.close();
- response.finish();
- }
- else
- {
- writeMore();
- }
- }
- catch (e)
- {
- try
- {
- fis.close();
- }
- finally
- {
- response.finish();
- }
- throw e;
- }
- }
- };
-
- writeMore();
-
- // Now that we know copying will start, flag the response as async.
- response.processAsync();
- }
- },
-
- /**
- * Get the value corresponding to a given key for the given path for SJS state
- * preservation across requests.
- *
- * @param path : string
- * the path from which the given state is to be retrieved
- * @param k : string
- * the key whose corresponding value is to be returned
- * @returns string
- * the corresponding value, which is initially the empty string
- */
- _getState: function(path, k)
- {
- var state = this._state;
- if (path in state && k in state[path])
- return state[path][k];
- return "";
- },
-
- /**
- * Set the value corresponding to a given key for the given path for SJS state
- * preservation across requests.
- *
- * @param path : string
- * the path from which the given state is to be retrieved
- * @param k : string
- * the key whose corresponding value is to be set
- * @param v : string
- * the value to be set
- */
- _setState: function(path, k, v)
- {
- if (typeof v !== "string")
- throw new Error("non-string value passed");
- var state = this._state;
- if (!(path in state))
- state[path] = {};
- state[path][k] = v;
- },
-
- /**
- * Get the value corresponding to a given key for SJS state preservation
- * across requests.
- *
- * @param k : string
- * the key whose corresponding value is to be returned
- * @returns string
- * the corresponding value, which is initially the empty string
- */
- _getSharedState: function(k)
- {
- var state = this._sharedState;
- if (k in state)
- return state[k];
- return "";
- },
-
- /**
- * Set the value corresponding to a given key for SJS state preservation
- * across requests.
- *
- * @param k : string
- * the key whose corresponding value is to be set
- * @param v : string
- * the value to be set
- */
- _setSharedState: function(k, v)
- {
- if (typeof v !== "string")
- throw new Error("non-string value passed");
- this._sharedState[k] = v;
- },
-
- /**
- * Returns the object associated with the given key in the server for SJS
- * state preservation across requests.
- *
- * @param k : string
- * the key whose corresponding object is to be returned
- * @returns nsISupports
- * the corresponding object, or null if none was present
- */
- _getObjectState: function(k)
- {
- if (typeof k !== "string")
- throw new Error("non-string key passed");
- return this._objectState[k] || null;
- },
-
- /**
- * Sets the object associated with the given key in the server for SJS
- * state preservation across requests.
- *
- * @param k : string
- * the key whose corresponding object is to be set
- * @param v : nsISupports
- * the object to be associated with the given key; may be null
- */
- _setObjectState: function(k, v)
- {
- if (typeof k !== "string")
- throw new Error("non-string key passed");
- if (typeof v !== "object")
- throw new Error("non-object value passed");
- if (v && !("QueryInterface" in v))
- {
- throw new Error("must pass an nsISupports; use wrappedJSObject to ease " +
- "pain when using the server from JS");
- }
-
- this._objectState[k] = v;
- },
-
- /**
- * Gets a content-type for the given file, first by checking for any custom
- * MIME-types registered with this handler for the file's extension, second by
- * asking the global MIME service for a content-type, and finally by failing
- * over to application/octet-stream.
- *
- * @param file : nsIFile
- * the nsIFile for which to get a file type
- * @returns string
- * the best content-type which can be determined for the file
- */
- _getTypeFromFile: function(file)
- {
- try
- {
- var name = file.leafName;
- var dot = name.lastIndexOf(".");
- if (dot > 0)
- {
- var ext = name.slice(dot + 1);
- if (ext in this._mimeMappings)
- return this._mimeMappings[ext];
- }
- return Cc["@mozilla.org/uriloader/external-helper-app-service;1"]
- .getService(Ci.nsIMIMEService)
- .getTypeFromFile(file);
- }
- catch (e)
- {
- return "application/octet-stream";
- }
- },
-
- /**
- * Returns the nsILocalFile which corresponds to the path, as determined using
- * all registered path->directory mappings and any paths which are explicitly
- * overridden.
- *
- * @param path : string
- * the server path for which a file should be retrieved, e.g. "/foo/bar"
- * @throws HttpError
- * when the correct action is the corresponding HTTP error (i.e., because no
- * mapping was found for a directory in path, the referenced file doesn't
- * exist, etc.)
- * @returns nsILocalFile
- * the file to be sent as the response to a request for the path
- */
- _getFileForPath: function(path)
- {
- // decode and add underscores as necessary
- try
- {
- path = toInternalPath(path, true);
- }
- catch (e)
- {
- throw HTTP_400; // malformed path
- }
-
- // next, get the directory which contains this path
- var pathMap = this._pathDirectoryMap;
-
- // An example progression of tmp for a path "/foo/bar/baz/" might be:
- // "foo/bar/baz/", "foo/bar/baz", "foo/bar", "foo", ""
- var tmp = path.substring(1);
- while (true)
- {
- // do we have a match for current head of the path?
- var file = pathMap.get(tmp);
- if (file)
- {
- // XXX hack; basically disable showing mapping for /foo/bar/ when the
- // requested path was /foo/bar, because relative links on the page
- // will all be incorrect -- we really need the ability to easily
- // redirect here instead
- if (tmp == path.substring(1) &&
- tmp.length != 0 &&
- tmp.charAt(tmp.length - 1) != "/")
- file = null;
- else
- break;
- }
-
- // if we've finished trying all prefixes, exit
- if (tmp == "")
- break;
-
- tmp = tmp.substring(0, tmp.lastIndexOf("/"));
- }
-
- // no mapping applies, so 404
- if (!file)
- throw HTTP_404;
-
-
- // last, get the file for the path within the determined directory
- var parentFolder = file.parent;
- var dirIsRoot = (parentFolder == null);
-
- // Strategy here is to append components individually, making sure we
- // never move above the given directory; this allows paths such as
- // "<file>/foo/../bar" but prevents paths such as "<file>/../base-sibling";
- // this component-wise approach also means the code works even on platforms
- // which don't use "/" as the directory separator, such as Windows
- var leafPath = path.substring(tmp.length + 1);
- var comps = leafPath.split("/");
- for (var i = 0, sz = comps.length; i < sz; i++)
- {
- var comp = comps[i];
-
- if (comp == "..")
- file = file.parent;
- else if (comp == "." || comp == "")
- continue;
- else
- file.append(comp);
-
- if (!dirIsRoot && file.equals(parentFolder))
- throw HTTP_403;
- }
-
- return file;
- },
-
- /**
- * Writes the error page for the given HTTP error code over the given
- * connection.
- *
- * @param errorCode : uint
- * the HTTP error code to be used
- * @param connection : Connection
- * the connection on which the error occurred
- */
- handleError: function(errorCode, connection)
- {
- var response = new Response(connection);
-
- dumpn("*** error in request: " + errorCode);
-
- this._handleError(errorCode, new Request(connection.port), response);
- },
-
- /**
- * Handles a request which generates the given error code, using the
- * user-defined error handler if one has been set, gracefully falling back to
- * the x00 status code if the code has no handler, and failing to status code
- * 500 if all else fails.
- *
- * @param errorCode : uint
- * the HTTP error which is to be returned
- * @param metadata : Request
- * metadata for the request, which will often be incomplete since this is an
- * error
- * @param response : Response
- * an uninitialized Response should be initialized when this method
- * completes with information which represents the desired error code in the
- * ideal case or a fallback code in abnormal circumstances (i.e., 500 is a
- * fallback for 505, per HTTP specs)
- */
- _handleError: function(errorCode, metadata, response)
- {
- if (!metadata)
- throw Cr.NS_ERROR_NULL_POINTER;
-
- var errorX00 = errorCode - (errorCode % 100);
-
- try
- {
- if (!(errorCode in HTTP_ERROR_CODES))
- dumpn("*** WARNING: requested invalid error: " + errorCode);
-
- // RFC 2616 says that we should try to handle an error by its class if we
- // can't otherwise handle it -- if that fails, we revert to handling it as
- // a 500 internal server error, and if that fails we throw and shut down
- // the server
-
- // actually handle the error
- try
- {
- if (errorCode in this._overrideErrors)
- this._overrideErrors[errorCode](metadata, response);
- else
- this._defaultErrors[errorCode](metadata, response);
- }
- catch (e)
- {
- if (response.partiallySent())
- {
- response.abort(e);
- return;
- }
-
- // don't retry the handler that threw
- if (errorX00 == errorCode)
- throw HTTP_500;
-
- dumpn("*** error in handling for error code " + errorCode + ", " +
- "falling back to " + errorX00 + "...");
- response = new Response(response._connection);
- if (errorX00 in this._overrideErrors)
- this._overrideErrors[errorX00](metadata, response);
- else if (errorX00 in this._defaultErrors)
- this._defaultErrors[errorX00](metadata, response);
- else
- throw HTTP_500;
- }
- }
- catch (e)
- {
- if (response.partiallySent())
- {
- response.abort();
- return;
- }
-
- // we've tried everything possible for a meaningful error -- now try 500
- dumpn("*** error in handling for error code " + errorX00 + ", falling " +
- "back to 500...");
-
- try
- {
- response = new Response(response._connection);
- if (500 in this._overrideErrors)
- this._overrideErrors[500](metadata, response);
- else
- this._defaultErrors[500](metadata, response);
- }
- catch (e2)
- {
- dumpn("*** multiple errors in default error handlers!");
- dumpn("*** e == " + e + ", e2 == " + e2);
- response.abort(e2);
- return;
- }
- }
-
- response.complete();
- },
-
- // FIELDS
-
- /**
- * This object contains the default handlers for the various HTTP error codes.
- */
- _defaultErrors:
- {
- 400: function(metadata, response)
- {
- // none of the data in metadata is reliable, so hard-code everything here
- response.setStatusLine("1.1", 400, "Bad Request");
- response.setHeader("Content-Type", "text/plain", false);
-
- var body = "Bad request\n";
- response.bodyOutputStream.write(body, body.length);
- },
- 403: function(metadata, response)
- {
- response.setStatusLine(metadata.httpVersion, 403, "Forbidden");
- response.setHeader("Content-Type", "text/html", false);
-
- var body = "<html>\
- <head><title>403 Forbidden</title></head>\
- <body>\
- <h1>403 Forbidden</h1>\
- </body>\
- </html>";
- response.bodyOutputStream.write(body, body.length);
- },
- 404: function(metadata, response)
- {
- response.setStatusLine(metadata.httpVersion, 404, "Not Found");
- response.setHeader("Content-Type", "text/html", false);
-
- var body = "<html>\
- <head><title>404 Not Found</title></head>\
- <body>\
- <h1>404 Not Found</h1>\
- <p>\
- <span style='font-family: monospace;'>" +
- htmlEscape(metadata.path) +
- "</span> was not found.\
- </p>\
- </body>\
- </html>";
- response.bodyOutputStream.write(body, body.length);
- },
- 416: function(metadata, response)
- {
- response.setStatusLine(metadata.httpVersion,
- 416,
- "Requested Range Not Satisfiable");
- response.setHeader("Content-Type", "text/html", false);
-
- var body = "<html>\
- <head>\
- <title>416 Requested Range Not Satisfiable</title></head>\
- <body>\
- <h1>416 Requested Range Not Satisfiable</h1>\
- <p>The byte range was not valid for the\
- requested resource.\
- </p>\
- </body>\
- </html>";
- response.bodyOutputStream.write(body, body.length);
- },
- 500: function(metadata, response)
- {
- response.setStatusLine(metadata.httpVersion,
- 500,
- "Internal Server Error");
- response.setHeader("Content-Type", "text/html", false);
-
- var body = "<html>\
- <head><title>500 Internal Server Error</title></head>\
- <body>\
- <h1>500 Internal Server Error</h1>\
- <p>Something's broken in this server and\
- needs to be fixed.</p>\
- </body>\
- </html>";
- response.bodyOutputStream.write(body, body.length);
- },
- 501: function(metadata, response)
- {
- response.setStatusLine(metadata.httpVersion, 501, "Not Implemented");
- response.setHeader("Content-Type", "text/html", false);
-
- var body = "<html>\
- <head><title>501 Not Implemented</title></head>\
- <body>\
- <h1>501 Not Implemented</h1>\
- <p>This server is not (yet) Apache.</p>\
- </body>\
- </html>";
- response.bodyOutputStream.write(body, body.length);
- },
- 505: function(metadata, response)
- {
- response.setStatusLine("1.1", 505, "HTTP Version Not Supported");
- response.setHeader("Content-Type", "text/html", false);
-
- var body = "<html>\
- <head><title>505 HTTP Version Not Supported</title></head>\
- <body>\
- <h1>505 HTTP Version Not Supported</h1>\
- <p>This server only supports HTTP/1.0 and HTTP/1.1\
- connections.</p>\
- </body>\
- </html>";
- response.bodyOutputStream.write(body, body.length);
- }
- },
-
- /**
- * Contains handlers for the default set of URIs contained in this server.
- */
- _defaultPaths:
- {
- "/": function(metadata, response)
- {
- response.setStatusLine(metadata.httpVersion, 200, "OK");
- response.setHeader("Content-Type", "text/html", false);
-
- var body = "<html>\
- <head><title>httpd.js</title></head>\
- <body>\
- <h1>httpd.js</h1>\
- <p>If you're seeing this page, httpd.js is up and\
- serving requests! Now set a base path and serve some\
- files!</p>\
- </body>\
- </html>";
-
- response.bodyOutputStream.write(body, body.length);
- },
-
- "/trace": function(metadata, response)
- {
- response.setStatusLine(metadata.httpVersion, 200, "OK");
- response.setHeader("Content-Type", "text/plain", false);
-
- var body = "Request-URI: " +
- metadata.scheme + "://" + metadata.host + ":" + metadata.port +
- metadata.path + "\n\n";
- body += "Request (semantically equivalent, slightly reformatted):\n\n";
- body += metadata.method + " " + metadata.path;
-
- if (metadata.queryString)
- body += "?" + metadata.queryString;
-
- body += " HTTP/" + metadata.httpVersion + "\r\n";
-
- var headEnum = metadata.headers;
- while (headEnum.hasMoreElements())
- {
- var fieldName = headEnum.getNext()
- .QueryInterface(Ci.nsISupportsString)
- .data;
- body += fieldName + ": " + metadata.getHeader(fieldName) + "\r\n";
- }
-
- response.bodyOutputStream.write(body, body.length);
- }
- }
-};
-
-
-/**
- * Maps absolute paths to files on the local file system (as nsILocalFiles).
- */
-function FileMap()
-{
- /** Hash which will map paths to nsILocalFiles. */
- this._map = {};
-}
-FileMap.prototype =
-{
- // PUBLIC API
-
- /**
- * Maps key to a clone of the nsILocalFile value if value is non-null;
- * otherwise, removes any extant mapping for key.
- *
- * @param key : string
- * string to which a clone of value is mapped
- * @param value : nsILocalFile
- * the file to map to key, or null to remove a mapping
- */
- put: function(key, value)
- {
- if (value)
- this._map[key] = value.clone();
- else
- delete this._map[key];
- },
-
- /**
- * Returns a clone of the nsILocalFile mapped to key, or null if no such
- * mapping exists.
- *
- * @param key : string
- * key to which the returned file maps
- * @returns nsILocalFile
- * a clone of the mapped file, or null if no mapping exists
- */
- get: function(key)
- {
- var val = this._map[key];
- return val ? val.clone() : null;
- }
-};
-
-
-// Response CONSTANTS
-
-// token = *<any CHAR except CTLs or separators>
-// CHAR = <any US-ASCII character (0-127)>
-// CTL = <any US-ASCII control character (0-31) and DEL (127)>
-// separators = "(" | ")" | "<" | ">" | "@"
-// | "," | ";" | ":" | "\" | <">
-// | "/" | "[" | "]" | "?" | "="
-// | "{" | "}" | SP | HT
-const IS_TOKEN_ARRAY =
- [0, 0, 0, 0, 0, 0, 0, 0, // 0
- 0, 0, 0, 0, 0, 0, 0, 0, // 8
- 0, 0, 0, 0, 0, 0, 0, 0, // 16
- 0, 0, 0, 0, 0, 0, 0, 0, // 24
-
- 0, 1, 0, 1, 1, 1, 1, 1, // 32
- 0, 0, 1, 1, 0, 1, 1, 0, // 40
- 1, 1, 1, 1, 1, 1, 1, 1, // 48
- 1, 1, 0, 0, 0, 0, 0, 0, // 56
-
- 0, 1, 1, 1, 1, 1, 1, 1, // 64
- 1, 1, 1, 1, 1, 1, 1, 1, // 72
- 1, 1, 1, 1, 1, 1, 1, 1, // 80
- 1, 1, 1, 0, 0, 0, 1, 1, // 88
-
- 1, 1, 1, 1, 1, 1, 1, 1, // 96
- 1, 1, 1, 1, 1, 1, 1, 1, // 104
- 1, 1, 1, 1, 1, 1, 1, 1, // 112
- 1, 1, 1, 0, 1, 0, 1]; // 120
-
-
-/**
- * Determines whether the given character code is a CTL.
- *
- * @param code : uint
- * the character code
- * @returns boolean
- * true if code is a CTL, false otherwise
- */
-function isCTL(code)
-{
- return (code >= 0 && code <= 31) || (code == 127);
-}
-
-/**
- * Represents a response to an HTTP request, encapsulating all details of that
- * response. This includes all headers, the HTTP version, status code and
- * explanation, and the entity itself.
- *
- * @param connection : Connection
- * the connection over which this response is to be written
- */
-function Response(connection)
-{
- /** The connection over which this response will be written. */
- this._connection = connection;
-
- /**
- * The HTTP version of this response; defaults to 1.1 if not set by the
- * handler.
- */
- this._httpVersion = nsHttpVersion.HTTP_1_1;
-
- /**
- * The HTTP code of this response; defaults to 200.
- */
- this._httpCode = 200;
-
- /**
- * The description of the HTTP code in this response; defaults to "OK".
- */
- this._httpDescription = "OK";
-
- /**
- * An nsIHttpHeaders object in which the headers in this response should be
- * stored. This property is null after the status line and headers have been
- * written to the network, and it may be modified up until it is cleared,
- * except if this._finished is set first (in which case headers are written
- * asynchronously in response to a finish() call not preceded by
- * flushHeaders()).
- */
- this._headers = new nsHttpHeaders();
-
- /**
- * Set to true when this response is ended (completely constructed if possible
- * and the connection closed); further actions on this will then fail.
- */
- this._ended = false;
-
- /**
- * A stream used to hold data written to the body of this response.
- */
- this._bodyOutputStream = null;
-
- /**
- * A stream containing all data that has been written to the body of this
- * response so far. (Async handlers make the data contained in this
- * unreliable as a way of determining content length in general, but auxiliary
- * saved information can sometimes be used to guarantee reliability.)
- */
- this._bodyInputStream = null;
-
- /**
- * A stream copier which copies data to the network. It is initially null
- * until replaced with a copier for response headers; when headers have been
- * fully sent it is replaced with a copier for the response body, remaining
- * so for the duration of response processing.
- */
- this._asyncCopier = null;
-
- /**
- * True if this response has been designated as being processed
- * asynchronously rather than for the duration of a single call to
- * nsIHttpRequestHandler.handle.
- */
- this._processAsync = false;
-
- /**
- * True iff finish() has been called on this, signaling that no more changes
- * to this may be made.
- */
- this._finished = false;
-
- /**
- * True iff powerSeized() has been called on this, signaling that this
- * response is to be handled manually by the response handler (which may then
- * send arbitrary data in response, even non-HTTP responses).
- */
- this._powerSeized = false;
-}
-Response.prototype =
-{
- // PUBLIC CONSTRUCTION API
-
- //
- // see nsIHttpResponse.bodyOutputStream
- //
- get bodyOutputStream()
- {
- if (this._finished)
- throw Cr.NS_ERROR_NOT_AVAILABLE;
-
- if (!this._bodyOutputStream)
- {
- var pipe = new Pipe(true, false, Response.SEGMENT_SIZE, PR_UINT32_MAX,
- null);
- this._bodyOutputStream = pipe.outputStream;
- this._bodyInputStream = pipe.inputStream;
- if (this._processAsync || this._powerSeized)
- this._startAsyncProcessor();
- }
-
- return this._bodyOutputStream;
- },
-
- //
- // see nsIHttpResponse.write
- //
- write: function(data)
- {
- if (this._finished)
- throw Cr.NS_ERROR_NOT_AVAILABLE;
-
- var dataAsString = String(data);
- this.bodyOutputStream.write(dataAsString, dataAsString.length);
- },
-
- //
- // see nsIHttpResponse.setStatusLine
- //
- setStatusLine: function(httpVersion, code, description)
- {
- if (!this._headers || this._finished || this._powerSeized)
- throw Cr.NS_ERROR_NOT_AVAILABLE;
- this._ensureAlive();
-
- if (!(code >= 0 && code < 1000))
- throw Cr.NS_ERROR_INVALID_ARG;
-
- try
- {
- var httpVer;
- // avoid version construction for the most common cases
- if (!httpVersion || httpVersion == "1.1")
- httpVer = nsHttpVersion.HTTP_1_1;
- else if (httpVersion == "1.0")
- httpVer = nsHttpVersion.HTTP_1_0;
- else
- httpVer = new nsHttpVersion(httpVersion);
- }
- catch (e)
- {
- throw Cr.NS_ERROR_INVALID_ARG;
- }
-
- // Reason-Phrase = *<TEXT, excluding CR, LF>
- // TEXT = <any OCTET except CTLs, but including LWS>
- //
- // XXX this ends up disallowing octets which aren't Unicode, I think -- not
- // much to do if description is IDL'd as string
- if (!description)
- description = "";
- for (var i = 0; i < description.length; i++)
- if (isCTL(description.charCodeAt(i)) && description.charAt(i) != "\t")
- throw Cr.NS_ERROR_INVALID_ARG;
-
- // set the values only after validation to preserve atomicity
- this._httpDescription = description;
- this._httpCode = code;
- this._httpVersion = httpVer;
- },
-
- //
- // see nsIHttpResponse.setHeader
- //
- setHeader: function(name, value, merge)
- {
- if (!this._headers || this._finished || this._powerSeized)
- throw Cr.NS_ERROR_NOT_AVAILABLE;
- this._ensureAlive();
-
- this._headers.setHeader(name, value, merge);
- },
-
- //
- // see nsIHttpResponse.processAsync
- //
- processAsync: function()
- {
- if (this._finished)
- throw Cr.NS_ERROR_UNEXPECTED;
- if (this._powerSeized)
- throw Cr.NS_ERROR_NOT_AVAILABLE;
- if (this._processAsync)
- return;
- this._ensureAlive();
-
- dumpn("*** processing connection " + this._connection.number + " async");
- this._processAsync = true;
-
- /*
- * Either the bodyOutputStream getter or this method is responsible for
- * starting the asynchronous processor and catching writes of data to the
- * response body of async responses as they happen, for the purpose of
- * forwarding those writes to the actual connection's output stream.
- * If bodyOutputStream is accessed first, calling this method will create
- * the processor (when it first is clear that body data is to be written
- * immediately, not buffered). If this method is called first, accessing
- * bodyOutputStream will create the processor. If only this method is
- * called, we'll write nothing, neither headers nor the nonexistent body,
- * until finish() is called. Since that delay is easily avoided by simply
- * getting bodyOutputStream or calling write(""), we don't worry about it.
- */
- if (this._bodyOutputStream && !this._asyncCopier)
- this._startAsyncProcessor();
- },
-
- //
- // see nsIHttpResponse.seizePower
- //
- seizePower: function()
- {
- if (this._processAsync)
- throw Cr.NS_ERROR_NOT_AVAILABLE;
- if (this._finished)
- throw Cr.NS_ERROR_UNEXPECTED;
- if (this._powerSeized)
- return;
- this._ensureAlive();
-
- dumpn("*** forcefully seizing power over connection " +
- this._connection.number + "...");
-
- // Purge any already-written data without sending it. We could as easily
- // swap out the streams entirely, but that makes it possible to acquire and
- // unknowingly use a stale reference, so we require there only be one of
- // each stream ever for any response to avoid this complication.
- if (this._asyncCopier)
- this._asyncCopier.cancel(Cr.NS_BINDING_ABORTED);
- this._asyncCopier = null;
- if (this._bodyOutputStream)
- {
- var input = new BinaryInputStream(this._bodyInputStream);
- var avail;
- while ((avail = input.available()) > 0)
- input.readByteArray(avail);
- }
-
- this._powerSeized = true;
- if (this._bodyOutputStream)
- this._startAsyncProcessor();
- },
-
- //
- // see nsIHttpResponse.finish
- //
- finish: function()
- {
- if (!this._processAsync && !this._powerSeized)
- throw Cr.NS_ERROR_UNEXPECTED;
- if (this._finished)
- return;
-
- dumpn("*** finishing connection " + this._connection.number);
- this._startAsyncProcessor(); // in case bodyOutputStream was never accessed
- if (this._bodyOutputStream)
- this._bodyOutputStream.close();
- this._finished = true;
- },
-
-
- // NSISUPPORTS
-
- //
- // see nsISupports.QueryInterface
- //
- QueryInterface: function(iid)
- {
- if (iid.equals(Ci.nsIHttpResponse) || iid.equals(Ci.nsISupports))
- return this;
-
- throw Cr.NS_ERROR_NO_INTERFACE;
- },
-
-
- // POST-CONSTRUCTION API (not exposed externally)
-
- /**
- * The HTTP version number of this, as a string (e.g. "1.1").
- */
- get httpVersion()
- {
- this._ensureAlive();
- return this._httpVersion.toString();
- },
-
- /**
- * The HTTP status code of this response, as a string of three characters per
- * RFC 2616.
- */
- get httpCode()
- {
- this._ensureAlive();
-
- var codeString = (this._httpCode < 10 ? "0" : "") +
- (this._httpCode < 100 ? "0" : "") +
- this._httpCode;
- return codeString;
- },
-
- /**
- * The description of the HTTP status code of this response, or "" if none is
- * set.
- */
- get httpDescription()
- {
- this._ensureAlive();
-
- return this._httpDescription;
- },
-
- /**
- * The headers in this response, as an nsHttpHeaders object.
- */
- get headers()
- {
- this._ensureAlive();
-
- return this._headers;
- },
-
- //
- // see nsHttpHeaders.getHeader
- //
- getHeader: function(name)
- {
- this._ensureAlive();
-
- return this._headers.getHeader(name);
- },
-
- /**
- * Determines whether this response may be abandoned in favor of a newly
- * constructed response. A response may be abandoned only if it is not being
- * sent asynchronously and if raw control over it has not been taken from the
- * server.
- *
- * @returns boolean
- * true iff no data has been written to the network
- */
- partiallySent: function()
- {
- dumpn("*** partiallySent()");
- return this._processAsync || this._powerSeized;
- },
-
- /**
- * If necessary, kicks off the remaining request processing needed to be done
- * after a request handler performs its initial work upon this response.
- */
- complete: function()
- {
- dumpn("*** complete()");
- if (this._processAsync || this._powerSeized)
- {
- NS_ASSERT(this._processAsync ^ this._powerSeized,
- "can't both send async and relinquish power");
- return;
- }
-
- NS_ASSERT(!this.partiallySent(), "completing a partially-sent response?");
-
- this._startAsyncProcessor();
-
- // Now make sure we finish processing this request!
- if (this._bodyOutputStream)
- this._bodyOutputStream.close();
- },
-
- /**
- * Abruptly ends processing of this response, usually due to an error in an
- * incoming request but potentially due to a bad error handler. Since we
- * cannot handle the error in the usual way (giving an HTTP error page in
- * response) because data may already have been sent (or because the response
- * might be expected to have been generated asynchronously or completely from
- * scratch by the handler), we stop processing this response and abruptly
- * close the connection.
- *
- * @param e : Error
- * the exception which precipitated this abort, or null if no such exception
- * was generated
- */
- abort: function(e)
- {
- dumpn("*** abort(<" + e + ">)");
-
- // This response will be ended by the processor if one was created.
- var copier = this._asyncCopier;
- if (copier)
- {
- // We dispatch asynchronously here so that any pending writes of data to
- // the connection will be deterministically written. This makes it easier
- // to specify exact behavior, and it makes observable behavior more
- // predictable for clients. Note that the correctness of this depends on
- // callbacks in response to _waitToReadData in WriteThroughCopier
- // happening asynchronously with respect to the actual writing of data to
- // bodyOutputStream, as they currently do; if they happened synchronously,
- // an event which ran before this one could write more data to the
- // response body before we get around to canceling the copier. We have
- // tests for this in test_seizepower.js, however, and I can't think of a
- // way to handle both cases without removing bodyOutputStream access and
- // moving its effective write(data, length) method onto Response, which
- // would be slower and require more code than this anyway.
- gThreadManager.currentThread.dispatch({
- run: function()
- {
- dumpn("*** canceling copy asynchronously...");
- copier.cancel(Cr.NS_ERROR_UNEXPECTED);
- }
- }, Ci.nsIThread.DISPATCH_NORMAL);
- }
- else
- {
- this.end();
- }
- },
-
- /**
- * Closes this response's network connection, marks the response as finished,
- * and notifies the server handler that the request is done being processed.
- */
- end: function()
- {
- NS_ASSERT(!this._ended, "ending this response twice?!?!");
-
- this._connection.close();
- if (this._bodyOutputStream)
- this._bodyOutputStream.close();
-
- this._finished = true;
- this._ended = true;
- },
-
- // PRIVATE IMPLEMENTATION
-
- /**
- * Sends the status line and headers of this response if they haven't been
- * sent and initiates the process of copying data written to this response's
- * body to the network.
- */
- _startAsyncProcessor: function()
- {
- dumpn("*** _startAsyncProcessor()");
-
- // Handle cases where we're being called a second time. The former case
- // happens when this is triggered both by complete() and by processAsync(),
- // while the latter happens when processAsync() in conjunction with sent
- // data causes abort() to be called.
- if (this._asyncCopier || this._ended)
- {
- dumpn("*** ignoring second call to _startAsyncProcessor");
- return;
- }
-
- // Send headers if they haven't been sent already and should be sent, then
- // asynchronously continue to send the body.
- if (this._headers && !this._powerSeized)
- {
- this._sendHeaders();
- return;
- }
-
- this._headers = null;
- this._sendBody();
- },
-
- /**
- * Signals that all modifications to the response status line and headers are
- * complete and then sends that data over the network to the client. Once
- * this method completes, a different response to the request that resulted
- * in this response cannot be sent -- the only possible action in case of
- * error is to abort the response and close the connection.
- */
- _sendHeaders: function()
- {
- dumpn("*** _sendHeaders()");
-
- NS_ASSERT(this._headers);
- NS_ASSERT(!this._powerSeized);
-
- // request-line
- var statusLine = "HTTP/" + this.httpVersion + " " +
- this.httpCode + " " +
- this.httpDescription + "\r\n";
-
- // header post-processing
-
- var headers = this._headers;
- headers.setHeader("Connection", "close", false);
- headers.setHeader("Server", "httpd.js", false);
- if (!headers.hasHeader("Date"))
- headers.setHeader("Date", toDateString(Date.now()), false);
-
- // Any response not being processed asynchronously must have an associated
- // Content-Length header for reasons of backwards compatibility with the
- // initial server, which fully buffered every response before sending it.
- // Beyond that, however, it's good to do this anyway because otherwise it's
- // impossible to test behaviors that depend on the presence or absence of a
- // Content-Length header.
- if (!this._processAsync)
- {
- dumpn("*** non-async response, set Content-Length");
-
- var bodyStream = this._bodyInputStream;
- var avail = bodyStream ? bodyStream.available() : 0;
-
- // XXX assumes stream will always report the full amount of data available
- headers.setHeader("Content-Length", "" + avail, false);
- }
-
-
- // construct and send response
- dumpn("*** header post-processing completed, sending response head...");
-
- // request-line
- var preambleData = [statusLine];
-
- // headers
- var headEnum = headers.enumerator;
- while (headEnum.hasMoreElements())
- {
- var fieldName = headEnum.getNext()
- .QueryInterface(Ci.nsISupportsString)
- .data;
- var values = headers.getHeaderValues(fieldName);
- for (var i = 0, sz = values.length; i < sz; i++)
- preambleData.push(fieldName + ": " + values[i] + "\r\n");
- }
-
- // end request-line/headers
- preambleData.push("\r\n");
-
- var preamble = preambleData.join("");
-
- var responseHeadPipe = new Pipe(true, false, 0, PR_UINT32_MAX, null);
- responseHeadPipe.outputStream.write(preamble, preamble.length);
-
- var response = this;
- var copyObserver =
- {
- onStartRequest: function(request, cx)
- {
- dumpn("*** preamble copying started");
- },
-
- onStopRequest: function(request, cx, statusCode)
- {
- dumpn("*** preamble copying complete " +
- "[status=0x" + statusCode.toString(16) + "]");
-
- if (!Components.isSuccessCode(statusCode))
- {
- dumpn("!!! header copying problems: non-success statusCode, " +
- "ending response");
-
- response.end();
- }
- else
- {
- response._sendBody();
- }
- },
-
- QueryInterface: function(aIID)
- {
- if (aIID.equals(Ci.nsIRequestObserver) || aIID.equals(Ci.nsISupports))
- return this;
-
- throw Cr.NS_ERROR_NO_INTERFACE;
- }
- };
-
- var headerCopier = this._asyncCopier =
- new WriteThroughCopier(responseHeadPipe.inputStream,
- this._connection.output,
- copyObserver, null);
-
- responseHeadPipe.outputStream.close();
-
- // Forbid setting any more headers or modifying the request line.
- this._headers = null;
- },
-
- /**
- * Asynchronously writes the body of the response (or the entire response, if
- * seizePower() has been called) to the network.
- */
- _sendBody: function()
- {
- dumpn("*** _sendBody");
-
- NS_ASSERT(!this._headers, "still have headers around but sending body?");
-
- // If no body data was written, we're done
- if (!this._bodyInputStream)
- {
- dumpn("*** empty body, response finished");
- this.end();
- return;
- }
-
- var response = this;
- var copyObserver =
- {
- onStartRequest: function(request, context)
- {
- dumpn("*** onStartRequest");
- },
-
- onStopRequest: function(request, cx, statusCode)
- {
- dumpn("*** onStopRequest [status=0x" + statusCode.toString(16) + "]");
-
- if (statusCode === Cr.NS_BINDING_ABORTED)
- {
- dumpn("*** terminating copy observer without ending the response");
- }
- else
- {
- if (!Components.isSuccessCode(statusCode))
- dumpn("*** WARNING: non-success statusCode in onStopRequest");
-
- response.end();
- }
- },
-
- QueryInterface: function(aIID)
- {
- if (aIID.equals(Ci.nsIRequestObserver) || aIID.equals(Ci.nsISupports))
- return this;
-
- throw Cr.NS_ERROR_NO_INTERFACE;
- }
- };
-
- dumpn("*** starting async copier of body data...");
- this._asyncCopier =
- new WriteThroughCopier(this._bodyInputStream, this._connection.output,
- copyObserver, null);
- },
-
- /** Ensures that this hasn't been ended. */
- _ensureAlive: function()
- {
- NS_ASSERT(!this._ended, "not handling response lifetime correctly");
- }
-};
-
-/**
- * Size of the segments in the buffer used in storing response data and writing
- * it to the socket.
- */
-Response.SEGMENT_SIZE = 8192;
-
-/** Serves double duty in WriteThroughCopier implementation. */
-function notImplemented()
-{
- throw Cr.NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/** Returns true iff the given exception represents stream closure. */
-function streamClosed(e)
-{
- return e === Cr.NS_BASE_STREAM_CLOSED ||
- (typeof e === "object" && e.result === Cr.NS_BASE_STREAM_CLOSED);
-}
-
-/** Returns true iff the given exception represents a blocked stream. */
-function wouldBlock(e)
-{
- return e === Cr.NS_BASE_STREAM_WOULD_BLOCK ||
- (typeof e === "object" && e.result === Cr.NS_BASE_STREAM_WOULD_BLOCK);
-}
-
-/**
- * Copies data from source to sink as it becomes available, when that data can
- * be written to sink without blocking.
- *
- * @param source : nsIAsyncInputStream
- * the stream from which data is to be read
- * @param sink : nsIAsyncOutputStream
- * the stream to which data is to be copied
- * @param observer : nsIRequestObserver
- * an observer which will be notified when the copy starts and finishes
- * @param context : nsISupports
- * context passed to observer when notified of start/stop
- * @throws NS_ERROR_NULL_POINTER
- * if source, sink, or observer are null
- */
-function WriteThroughCopier(source, sink, observer, context)
-{
- if (!source || !sink || !observer)
- throw Cr.NS_ERROR_NULL_POINTER;
-
- /** Stream from which data is being read. */
- this._source = source;
-
- /** Stream to which data is being written. */
- this._sink = sink;
-
- /** Observer watching this copy. */
- this._observer = observer;
-
- /** Context for the observer watching this. */
- this._context = context;
-
- /**
- * True iff this is currently being canceled (cancel has been called, the
- * callback may not yet have been made).
- */
- this._canceled = false;
-
- /**
- * False until all data has been read from input and written to output, at
- * which point this copy is completed and cancel() is asynchronously called.
- */
- this._completed = false;
-
- /** Required by nsIRequest, meaningless. */
- this.loadFlags = 0;
- /** Required by nsIRequest, meaningless. */
- this.loadGroup = null;
- /** Required by nsIRequest, meaningless. */
- this.name = "response-body-copy";
-
- /** Status of this request. */
- this.status = Cr.NS_OK;
-
- /** Arrays of byte strings waiting to be written to output. */
- this._pendingData = [];
-
- // start copying
- try
- {
- observer.onStartRequest(this, context);
- this._waitToReadData();
- this._waitForSinkClosure();
- }
- catch (e)
- {
- dumpn("!!! error starting copy: " + e +
- ("lineNumber" in e ? ", line " + e.lineNumber : ""));
- dumpn(e.stack);
- this.cancel(Cr.NS_ERROR_UNEXPECTED);
- }
-}
-WriteThroughCopier.prototype =
-{
- /* nsISupports implementation */
-
- QueryInterface: function(iid)
- {
- if (iid.equals(Ci.nsIInputStreamCallback) ||
- iid.equals(Ci.nsIOutputStreamCallback) ||
- iid.equals(Ci.nsIRequest) ||
- iid.equals(Ci.nsISupports))
- {
- return this;
- }
-
- throw Cr.NS_ERROR_NO_INTERFACE;
- },
-
-
- // NSIINPUTSTREAMCALLBACK
-
- /**
- * Receives a more-data-in-input notification and writes the corresponding
- * data to the output.
- *
- * @param input : nsIAsyncInputStream
- * the input stream on whose data we have been waiting
- */
- onInputStreamReady: function(input)
- {
- if (this._source === null)
- return;
-
- dumpn("*** onInputStreamReady");
-
- //
- // Ordinarily we'll read a non-zero amount of data from input, queue it up
- // to be written and then wait for further callbacks. The complications in
- // this method are the cases where we deviate from that behavior when errors
- // occur or when copying is drawing to a finish.
- //
- // The edge cases when reading data are:
- //
- // Zero data is read
- // If zero data was read, we're at the end of available data, so we can
- // should stop reading and move on to writing out what we have (or, if
- // we've already done that, onto notifying of completion).
- // A stream-closed exception is thrown
- // This is effectively a less kind version of zero data being read; the
- // only difference is that we notify of completion with that result
- // rather than with NS_OK.
- // Some other exception is thrown
- // This is the least kind result. We don't know what happened, so we
- // act as though the stream closed except that we notify of completion
- // with the result NS_ERROR_UNEXPECTED.
- //
-
- var bytesWanted = 0, bytesConsumed = -1;
- try
- {
- input = new BinaryInputStream(input);
-
- bytesWanted = Math.min(input.available(), Response.SEGMENT_SIZE);
- dumpn("*** input wanted: " + bytesWanted);
-
- if (bytesWanted > 0)
- {
- var data = input.readByteArray(bytesWanted);
- bytesConsumed = data.length;
- this._pendingData.push(String.fromCharCode.apply(String, data));
- }
-
- dumpn("*** " + bytesConsumed + " bytes read");
-
- // Handle the zero-data edge case in the same place as all other edge
- // cases are handled.
- if (bytesWanted === 0)
- throw Cr.NS_BASE_STREAM_CLOSED;
- }
- catch (e)
- {
- if (streamClosed(e))
- {
- dumpn("*** input stream closed");
- e = bytesWanted === 0 ? Cr.NS_OK : Cr.NS_ERROR_UNEXPECTED;
- }
- else
- {
- dumpn("!!! unexpected error reading from input, canceling: " + e);
- e = Cr.NS_ERROR_UNEXPECTED;
- }
-
- this._doneReadingSource(e);
- return;
- }
-
- var pendingData = this._pendingData;
-
- NS_ASSERT(bytesConsumed > 0);
- NS_ASSERT(pendingData.length > 0, "no pending data somehow?");
- NS_ASSERT(pendingData[pendingData.length - 1].length > 0,
- "buffered zero bytes of data?");
-
- NS_ASSERT(this._source !== null);
-
- // Reading has gone great, and we've gotten data to write now. What if we
- // don't have a place to write that data, because output went away just
- // before this read? Drop everything on the floor, including new data, and
- // cancel at this point.
- if (this._sink === null)
- {
- pendingData.length = 0;
- this._doneReadingSource(Cr.NS_ERROR_UNEXPECTED);
- return;
- }
-
- // Okay, we've read the data, and we know we have a place to write it. We
- // need to queue up the data to be written, but *only* if none is queued
- // already -- if data's already queued, the code that actually writes the
- // data will make sure to wait on unconsumed pending data.
- try
- {
- if (pendingData.length === 1)
- this._waitToWriteData();
- }
- catch (e)
- {
- dumpn("!!! error waiting to write data just read, swallowing and " +
- "writing only what we already have: " + e);
- this._doneWritingToSink(Cr.NS_ERROR_UNEXPECTED);
- return;
- }
-
- // Whee! We successfully read some data, and it's successfully queued up to
- // be written. All that remains now is to wait for more data to read.
- try
- {
- this._waitToReadData();
- }
- catch (e)
- {
- dumpn("!!! error waiting to read more data: " + e);
- this._doneReadingSource(Cr.NS_ERROR_UNEXPECTED);
- }
- },
-
-
- // NSIOUTPUTSTREAMCALLBACK
-
- /**
- * Callback when data may be written to the output stream without blocking, or
- * when the output stream has been closed.
- *
- * @param output : nsIAsyncOutputStream
- * the output stream on whose writability we've been waiting, also known as
- * this._sink
- */
- onOutputStreamReady: function(output)
- {
- if (this._sink === null)
- return;
-
- dumpn("*** onOutputStreamReady");
-
- var pendingData = this._pendingData;
- if (pendingData.length === 0)
- {
- // There's no pending data to write. The only way this can happen is if
- // we're waiting on the output stream's closure, so we can respond to a
- // copying failure as quickly as possible (rather than waiting for data to
- // be available to read and then fail to be copied). Therefore, we must
- // be done now -- don't bother to attempt to write anything and wrap
- // things up.
- dumpn("!!! output stream closed prematurely, ending copy");
-
- this._doneWritingToSink(Cr.NS_ERROR_UNEXPECTED);
- return;
- }
-
-
- NS_ASSERT(pendingData[0].length > 0, "queued up an empty quantum?");
-
- //
- // Write out the first pending quantum of data. The possible errors here
- // are:
- //
- // The write might fail because we can't write that much data
- // Okay, we've written what we can now, so re-queue what's left and
- // finish writing it out later.
- // The write failed because the stream was closed
- // Discard pending data that we can no longer write, stop reading, and
- // signal that copying finished.
- // Some other error occurred.
- // Same as if the stream were closed, but notify with the status
- // NS_ERROR_UNEXPECTED so the observer knows something was wonky.
- //
-
- try
- {
- var quantum = pendingData[0];
-
- // XXX |quantum| isn't guaranteed to be ASCII, so we're relying on
- // undefined behavior! We're only using this because writeByteArray
- // is unusably broken for asynchronous output streams; see bug 532834
- // for details.
- var bytesWritten = output.write(quantum, quantum.length);
- if (bytesWritten === quantum.length)
- pendingData.shift();
- else
- pendingData[0] = quantum.substring(bytesWritten);
-
- dumpn("*** wrote " + bytesWritten + " bytes of data");
- }
- catch (e)
- {
- if (wouldBlock(e))
- {
- NS_ASSERT(pendingData.length > 0,
- "stream-blocking exception with no data to write?");
- NS_ASSERT(pendingData[0].length > 0,
- "stream-blocking exception with empty quantum?");
- this._waitToWriteData();
- return;
- }
-
- if (streamClosed(e))
- dumpn("!!! output stream prematurely closed, signaling error...");
- else
- dumpn("!!! unknown error: " + e + ", quantum=" + quantum);
-
- this._doneWritingToSink(Cr.NS_ERROR_UNEXPECTED);
- return;
- }
-
- // The day is ours! Quantum written, now let's see if we have more data
- // still to write.
- try
- {
- if (pendingData.length > 0)
- {
- this._waitToWriteData();
- return;
- }
- }
- catch (e)
- {
- dumpn("!!! unexpected error waiting to write pending data: " + e);
- this._doneWritingToSink(Cr.NS_ERROR_UNEXPECTED);
- return;
- }
-
- // Okay, we have no more pending data to write -- but might we get more in
- // the future?
- if (this._source !== null)
- {
- /*
- * If we might, then wait for the output stream to be closed. (We wait
- * only for closure because we have no data to write -- and if we waited
- * for a specific amount of data, we would get repeatedly notified for no
- * reason if over time the output stream permitted more and more data to
- * be written to it without blocking.)
- */
- this._waitForSinkClosure();
- }
- else
- {
- /*
- * On the other hand, if we can't have more data because the input
- * stream's gone away, then it's time to notify of copy completion.
- * Victory!
- */
- this._sink = null;
- this._cancelOrDispatchCancelCallback(Cr.NS_OK);
- }
- },
-
-
- // NSIREQUEST
-
- /** Returns true if the cancel observer hasn't been notified yet. */
- isPending: function()
- {
- return !this._completed;
- },
-
- /** Not implemented, don't use! */
- suspend: notImplemented,
- /** Not implemented, don't use! */
- resume: notImplemented,
-
- /**
- * Cancels data reading from input, asynchronously writes out any pending
- * data, and causes the observer to be notified with the given error code when
- * all writing has finished.
- *
- * @param status : nsresult
- * the status to pass to the observer when data copying has been canceled
- */
- cancel: function(status)
- {
- dumpn("*** cancel(" + status.toString(16) + ")");
-
- if (this._canceled)
- {
- dumpn("*** suppressing a late cancel");
- return;
- }
-
- this._canceled = true;
- this.status = status;
-
- // We could be in the middle of absolutely anything at this point. Both
- // input and output might still be around, we might have pending data to
- // write, and in general we know nothing about the state of the world. We
- // therefore must assume everything's in progress and take everything to its
- // final steady state (or so far as it can go before we need to finish
- // writing out remaining data).
-
- this._doneReadingSource(status);
- },
-
-
- // PRIVATE IMPLEMENTATION
-
- /**
- * Stop reading input if we haven't already done so, passing e as the status
- * when closing the stream, and kick off a copy-completion notice if no more
- * data remains to be written.
- *
- * @param e : nsresult
- * the status to be used when closing the input stream
- */
- _doneReadingSource: function(e)
- {
- dumpn("*** _doneReadingSource(0x" + e.toString(16) + ")");
-
- this._finishSource(e);
- if (this._pendingData.length === 0)
- this._sink = null;
- else
- NS_ASSERT(this._sink !== null, "null output?");
-
- // If we've written out all data read up to this point, then it's time to
- // signal completion.
- if (this._sink === null)
- {
- NS_ASSERT(this._pendingData.length === 0, "pending data still?");
- this._cancelOrDispatchCancelCallback(e);
- }
- },
-
- /**
- * Stop writing output if we haven't already done so, discard any data that
- * remained to be sent, close off input if it wasn't already closed, and kick
- * off a copy-completion notice.
- *
- * @param e : nsresult
- * the status to be used when closing input if it wasn't already closed
- */
- _doneWritingToSink: function(e)
- {
- dumpn("*** _doneWritingToSink(0x" + e.toString(16) + ")");
-
- this._pendingData.length = 0;
- this._sink = null;
- this._doneReadingSource(e);
- },
-
- /**
- * Completes processing of this copy: either by canceling the copy if it
- * hasn't already been canceled using the provided status, or by dispatching
- * the cancel callback event (with the originally provided status, of course)
- * if it already has been canceled.
- *
- * @param status : nsresult
- * the status code to use to cancel this, if this hasn't already been
- * canceled
- */
- _cancelOrDispatchCancelCallback: function(status)
- {
- dumpn("*** _cancelOrDispatchCancelCallback(" + status + ")");
-
- NS_ASSERT(this._source === null, "should have finished input");
- NS_ASSERT(this._sink === null, "should have finished output");
- NS_ASSERT(this._pendingData.length === 0, "should have no pending data");
-
- if (!this._canceled)
- {
- this.cancel(status);
- return;
- }
-
- var self = this;
- var event =
- {
- run: function()
- {
- dumpn("*** onStopRequest async callback");
-
- self._completed = true;
- try
- {
- self._observer.onStopRequest(self, self._context, self.status);
- }
- catch (e)
- {
- NS_ASSERT(false,
- "how are we throwing an exception here? we control " +
- "all the callers! " + e);
- }
- }
- };
-
- gThreadManager.currentThread.dispatch(event, Ci.nsIThread.DISPATCH_NORMAL);
- },
-
- /**
- * Kicks off another wait for more data to be available from the input stream.
- */
- _waitToReadData: function()
- {
- dumpn("*** _waitToReadData");
- this._source.asyncWait(this, 0, Response.SEGMENT_SIZE,
- gThreadManager.mainThread);
- },
-
- /**
- * Kicks off another wait until data can be written to the output stream.
- */
- _waitToWriteData: function()
- {
- dumpn("*** _waitToWriteData");
-
- var pendingData = this._pendingData;
- NS_ASSERT(pendingData.length > 0, "no pending data to write?");
- NS_ASSERT(pendingData[0].length > 0, "buffered an empty write?");
-
- this._sink.asyncWait(this, 0, pendingData[0].length,
- gThreadManager.mainThread);
- },
-
- /**
- * Kicks off a wait for the sink to which data is being copied to be closed.
- * We wait for stream closure when we don't have any data to be copied, rather
- * than waiting to write a specific amount of data. We can't wait to write
- * data because the sink might be infinitely writable, and if no data appears
- * in the source for a long time we might have to spin quite a bit waiting to
- * write, waiting to write again, &c. Waiting on stream closure instead means
- * we'll get just one notification if the sink dies. Note that when data
- * starts arriving from the sink we'll resume waiting for data to be written,
- * dropping this closure-only callback entirely.
- */
- _waitForSinkClosure: function()
- {
- dumpn("*** _waitForSinkClosure");
-
- this._sink.asyncWait(this, Ci.nsIAsyncOutputStream.WAIT_CLOSURE_ONLY, 0,
- gThreadManager.mainThread);
- },
-
- /**
- * Closes input with the given status, if it hasn't already been closed;
- * otherwise a no-op.
- *
- * @param status : nsresult
- * status code use to close the source stream if necessary
- */
- _finishSource: function(status)
- {
- dumpn("*** _finishSource(" + status.toString(16) + ")");
-
- if (this._source !== null)
- {
- this._source.closeWithStatus(status);
- this._source = null;
- }
- }
-};
-
-
-/**
- * A container for utility functions used with HTTP headers.
- */
-const headerUtils =
-{
- /**
- * Normalizes fieldName (by converting it to lowercase) and ensures it is a
- * valid header field name (although not necessarily one specified in RFC
- * 2616).
- *
- * @throws NS_ERROR_INVALID_ARG
- * if fieldName does not match the field-name production in RFC 2616
- * @returns string
- * fieldName converted to lowercase if it is a valid header, for characters
- * where case conversion is possible
- */
- normalizeFieldName: function(fieldName)
- {
- if (fieldName == "")
- throw Cr.NS_ERROR_INVALID_ARG;
-
- for (var i = 0, sz = fieldName.length; i < sz; i++)
- {
- if (!IS_TOKEN_ARRAY[fieldName.charCodeAt(i)])
- {
- dumpn(fieldName + " is not a valid header field name!");
- throw Cr.NS_ERROR_INVALID_ARG;
- }
- }
-
- return fieldName.toLowerCase();
- },
-
- /**
- * Ensures that fieldValue is a valid header field value (although not
- * necessarily as specified in RFC 2616 if the corresponding field name is
- * part of the HTTP protocol), normalizes the value if it is, and
- * returns the normalized value.
- *
- * @param fieldValue : string
- * a value to be normalized as an HTTP header field value
- * @throws NS_ERROR_INVALID_ARG
- * if fieldValue does not match the field-value production in RFC 2616
- * @returns string
- * fieldValue as a normalized HTTP header field value
- */
- normalizeFieldValue: function(fieldValue)
- {
- // field-value = *( field-content | LWS )
- // field-content = <the OCTETs making up the field-value
- // and consisting of either *TEXT or combinations
- // of token, separators, and quoted-string>
- // TEXT = <any OCTET except CTLs,
- // but including LWS>
- // LWS = [CRLF] 1*( SP | HT )
- //
- // quoted-string = ( <"> *(qdtext | quoted-pair ) <"> )
- // qdtext = <any TEXT except <">>
- // quoted-pair = "\" CHAR
- // CHAR = <any US-ASCII character (octets 0 - 127)>
-
- // Any LWS that occurs between field-content MAY be replaced with a single
- // SP before interpreting the field value or forwarding the message
- // downstream (section 4.2); we replace 1*LWS with a single SP
- var val = fieldValue.replace(/(?:(?:\r\n)?[ \t]+)+/g, " ");
-
- // remove leading/trailing LWS (which has been converted to SP)
- val = val.replace(/^ +/, "").replace(/ +$/, "");
-
- // that should have taken care of all CTLs, so val should contain no CTLs
- for (var i = 0, len = val.length; i < len; i++)
- if (isCTL(val.charCodeAt(i)))
- throw Cr.NS_ERROR_INVALID_ARG;
-
- // XXX disallows quoted-pair where CHAR is a CTL -- will not invalidly
- // normalize, however, so this can be construed as a tightening of the
- // spec and not entirely as a bug
- return val;
- }
-};
-
-
-
-/**
- * Converts the given string into a string which is safe for use in an HTML
- * context.
- *
- * @param str : string
- * the string to make HTML-safe
- * @returns string
- * an HTML-safe version of str
- */
-function htmlEscape(str)
-{
- // this is naive, but it'll work
- var s = "";
- for (var i = 0; i < str.length; i++)
- s += "&#" + str.charCodeAt(i) + ";";
- return s;
-}
-
-
-/**
- * Constructs an object representing an HTTP version (see section 3.1).
- *
- * @param versionString
- * a string of the form "#.#", where # is an non-negative decimal integer with
- * or without leading zeros
- * @throws
- * if versionString does not specify a valid HTTP version number
- */
-function nsHttpVersion(versionString)
-{
- var matches = /^(\d+)\.(\d+)$/.exec(versionString);
- if (!matches)
- throw "Not a valid HTTP version!";
-
- /** The major version number of this, as a number. */
- this.major = parseInt(matches[1], 10);
-
- /** The minor version number of this, as a number. */
- this.minor = parseInt(matches[2], 10);
-
- if (isNaN(this.major) || isNaN(this.minor) ||
- this.major < 0 || this.minor < 0)
- throw "Not a valid HTTP version!";
-}
-nsHttpVersion.prototype =
-{
- /**
- * Returns the standard string representation of the HTTP version represented
- * by this (e.g., "1.1").
- */
- toString: function ()
- {
- return this.major + "." + this.minor;
- },
-
- /**
- * Returns true if this represents the same HTTP version as otherVersion,
- * false otherwise.
- *
- * @param otherVersion : nsHttpVersion
- * the version to compare against this
- */
- equals: function (otherVersion)
- {
- return this.major == otherVersion.major &&
- this.minor == otherVersion.minor;
- },
-
- /** True if this >= otherVersion, false otherwise. */
- atLeast: function(otherVersion)
- {
- return this.major > otherVersion.major ||
- (this.major == otherVersion.major &&
- this.minor >= otherVersion.minor);
- }
-};
-
-nsHttpVersion.HTTP_1_0 = new nsHttpVersion("1.0");
-nsHttpVersion.HTTP_1_1 = new nsHttpVersion("1.1");
-
-
-/**
- * An object which stores HTTP headers for a request or response.
- *
- * Note that since headers are case-insensitive, this object converts headers to
- * lowercase before storing them. This allows the getHeader and hasHeader
- * methods to work correctly for any case of a header, but it means that the
- * values returned by .enumerator may not be equal case-sensitively to the
- * values passed to setHeader when adding headers to this.
- */
-function nsHttpHeaders()
-{
- /**
- * A hash of headers, with header field names as the keys and header field
- * values as the values. Header field names are case-insensitive, but upon
- * insertion here they are converted to lowercase. Header field values are
- * normalized upon insertion to contain no leading or trailing whitespace.
- *
- * Note also that per RFC 2616, section 4.2, two headers with the same name in
- * a message may be treated as one header with the same field name and a field
- * value consisting of the separate field values joined together with a "," in
- * their original order. This hash stores multiple headers with the same name
- * in this manner.
- */
- this._headers = {};
-}
-nsHttpHeaders.prototype =
-{
- /**
- * Sets the header represented by name and value in this.
- *
- * @param name : string
- * the header name
- * @param value : string
- * the header value
- * @throws NS_ERROR_INVALID_ARG
- * if name or value is not a valid header component
- */
- setHeader: function(fieldName, fieldValue, merge)
- {
- var name = headerUtils.normalizeFieldName(fieldName);
- var value = headerUtils.normalizeFieldValue(fieldValue);
-
- // The following three headers are stored as arrays because their real-world
- // syntax prevents joining individual headers into a single header using
- // ",". See also <http://hg.mozilla.org/mozilla-central/diff/9b2a99adc05e/netwerk/protocol/http/src/nsHttpHeaderArray.cpp#l77>
- if (merge && name in this._headers)
- {
- if (name === "www-authenticate" ||
- name === "proxy-authenticate" ||
- name === "set-cookie")
- {
- this._headers[name].push(value);
- }
- else
- {
- this._headers[name][0] += "," + value;
- NS_ASSERT(this._headers[name].length === 1,
- "how'd a non-special header have multiple values?")
- }
- }
- else
- {
- this._headers[name] = [value];
- }
- },
-
- /**
- * Returns the value for the header specified by this.
- *
- * @throws NS_ERROR_INVALID_ARG
- * if fieldName does not constitute a valid header field name
- * @throws NS_ERROR_NOT_AVAILABLE
- * if the given header does not exist in this
- * @returns string
- * the field value for the given header, possibly with non-semantic changes
- * (i.e., leading/trailing whitespace stripped, whitespace runs replaced
- * with spaces, etc.) at the option of the implementation; multiple
- * instances of the header will be combined with a comma, except for
- * the three headers noted in the description of getHeaderValues
- */
- getHeader: function(fieldName)
- {
- return this.getHeaderValues(fieldName).join("\n");
- },
-
- /**
- * Returns the value for the header specified by fieldName as an array.
- *
- * @throws NS_ERROR_INVALID_ARG
- * if fieldName does not constitute a valid header field name
- * @throws NS_ERROR_NOT_AVAILABLE
- * if the given header does not exist in this
- * @returns [string]
- * an array of all the header values in this for the given
- * header name. Header values will generally be collapsed
- * into a single header by joining all header values together
- * with commas, but certain headers (Proxy-Authenticate,
- * WWW-Authenticate, and Set-Cookie) violate the HTTP spec
- * and cannot be collapsed in this manner. For these headers
- * only, the returned array may contain multiple elements if
- * that header has been added more than once.
- */
- getHeaderValues: function(fieldName)
- {
- var name = headerUtils.normalizeFieldName(fieldName);
-
- if (name in this._headers)
- return this._headers[name];
- else
- throw Cr.NS_ERROR_NOT_AVAILABLE;
- },
-
- /**
- * Returns true if a header with the given field name exists in this, false
- * otherwise.
- *
- * @param fieldName : string
- * the field name whose existence is to be determined in this
- * @throws NS_ERROR_INVALID_ARG
- * if fieldName does not constitute a valid header field name
- * @returns boolean
- * true if the header's present, false otherwise
- */
- hasHeader: function(fieldName)
- {
- var name = headerUtils.normalizeFieldName(fieldName);
- return (name in this._headers);
- },
-
- /**
- * Returns a new enumerator over the field names of the headers in this, as
- * nsISupportsStrings. The names returned will be in lowercase, regardless of
- * how they were input using setHeader (header names are case-insensitive per
- * RFC 2616).
- */
- get enumerator()
- {
- var headers = [];
- for (var i in this._headers)
- {
- var supports = new SupportsString();
- supports.data = i;
- headers.push(supports);
- }
-
- return new nsSimpleEnumerator(headers);
- }
-};
-
-
-/**
- * Constructs an nsISimpleEnumerator for the given array of items.
- *
- * @param items : Array
- * the items, which must all implement nsISupports
- */
-function nsSimpleEnumerator(items)
-{
- this._items = items;
- this._nextIndex = 0;
-}
-nsSimpleEnumerator.prototype =
-{
- hasMoreElements: function()
- {
- return this._nextIndex < this._items.length;
- },
- getNext: function()
- {
- if (!this.hasMoreElements())
- throw Cr.NS_ERROR_NOT_AVAILABLE;
-
- return this._items[this._nextIndex++];
- },
- QueryInterface: function(aIID)
- {
- if (Ci.nsISimpleEnumerator.equals(aIID) ||
- Ci.nsISupports.equals(aIID))
- return this;
-
- throw Cr.NS_ERROR_NO_INTERFACE;
- }
-};
-
-
-/**
- * A representation of the data in an HTTP request.
- *
- * @param port : uint
- * the port on which the server receiving this request runs
- */
-function Request(port)
-{
- /** Method of this request, e.g. GET or POST. */
- this._method = "";
-
- /** Path of the requested resource; empty paths are converted to '/'. */
- this._path = "";
-
- /** Query string, if any, associated with this request (not including '?'). */
- this._queryString = "";
-
- /** Scheme of requested resource, usually http, always lowercase. */
- this._scheme = "http";
-
- /** Hostname on which the requested resource resides. */
- this._host = undefined;
-
- /** Port number over which the request was received. */
- this._port = port;
-
- var bodyPipe = new Pipe(false, false, 0, PR_UINT32_MAX, null);
-
- /** Stream from which data in this request's body may be read. */
- this._bodyInputStream = bodyPipe.inputStream;
-
- /** Stream to which data in this request's body is written. */
- this._bodyOutputStream = bodyPipe.outputStream;
-
- /**
- * The headers in this request.
- */
- this._headers = new nsHttpHeaders();
-
- /**
- * For the addition of ad-hoc properties and new functionality without having
- * to change nsIHttpRequest every time; currently lazily created, as its only
- * use is in directory listings.
- */
- this._bag = null;
-}
-Request.prototype =
-{
- // SERVER METADATA
-
- //
- // see nsIHttpRequest.scheme
- //
- get scheme()
- {
- return this._scheme;
- },
-
- //
- // see nsIHttpRequest.host
- //
- get host()
- {
- return this._host;
- },
-
- //
- // see nsIHttpRequest.port
- //
- get port()
- {
- return this._port;
- },
-
- // REQUEST LINE
-
- //
- // see nsIHttpRequest.method
- //
- get method()
- {
- return this._method;
- },
-
- //
- // see nsIHttpRequest.httpVersion
- //
- get httpVersion()
- {
- return this._httpVersion.toString();
- },
-
- //
- // see nsIHttpRequest.path
- //
- get path()
- {
- return this._path;
- },
-
- //
- // see nsIHttpRequest.queryString
- //
- get queryString()
- {
- return this._queryString;
- },
-
- // HEADERS
-
- //
- // see nsIHttpRequest.getHeader
- //
- getHeader: function(name)
- {
- return this._headers.getHeader(name);
- },
-
- //
- // see nsIHttpRequest.hasHeader
- //
- hasHeader: function(name)
- {
- return this._headers.hasHeader(name);
- },
-
- //
- // see nsIHttpRequest.headers
- //
- get headers()
- {
- return this._headers.enumerator;
- },
-
- //
- // see nsIPropertyBag.enumerator
- //
- get enumerator()
- {
- this._ensurePropertyBag();
- return this._bag.enumerator;
- },
-
- //
- // see nsIHttpRequest.headers
- //
- get bodyInputStream()
- {
- return this._bodyInputStream;
- },
-
- //
- // see nsIPropertyBag.getProperty
- //
- getProperty: function(name)
- {
- this._ensurePropertyBag();
- return this._bag.getProperty(name);
- },
-
-
- // NSISUPPORTS
-
- //
- // see nsISupports.QueryInterface
- //
- QueryInterface: function(iid)
- {
- if (iid.equals(Ci.nsIHttpRequest) || iid.equals(Ci.nsISupports))
- return this;
-
- throw Cr.NS_ERROR_NO_INTERFACE;
- },
-
-
- // PRIVATE IMPLEMENTATION
-
- /** Ensures a property bag has been created for ad-hoc behaviors. */
- _ensurePropertyBag: function()
- {
- if (!this._bag)
- this._bag = new WritablePropertyBag();
- }
-};
-
-
-// XPCOM trappings
-if (XPCOMUtils.generateNSGetFactory)
- var NSGetFactory = XPCOMUtils.generateNSGetFactory([nsHttpServer]);
-else
- var NSGetModule = XPCOMUtils.generateNSGetModule([nsHttpServer]);
-
-/**
- * Creates a new HTTP server listening for loopback traffic on the given port,
- * starts it, and runs the server until the server processes a shutdown request,
- * spinning an event loop so that events posted by the server's socket are
- * processed.
- *
- * This method is primarily intended for use in running this script from within
- * xpcshell and running a functional HTTP server without having to deal with
- * non-essential details.
- *
- * Note that running multiple servers using variants of this method probably
- * doesn't work, simply due to how the internal event loop is spun and stopped.
- *
- * @note
- * This method only works with Mozilla 1.9 (i.e., Firefox 3 or trunk code);
- * you should use this server as a component in Mozilla 1.8.
- * @param port
- * the port on which the server will run, or -1 if there exists no preference
- * for a specific port; note that attempting to use some values for this
- * parameter (particularly those below 1024) may cause this method to throw or
- * may result in the server being prematurely shut down
- * @param basePath
- * a local directory from which requests will be served (i.e., if this is
- * "/home/jwalden/" then a request to /index.html will load
- * /home/jwalden/index.html); if this is omitted, only the default URLs in
- * this server implementation will be functional
- */
-function server(port, basePath)
-{
- if (basePath)
- {
- var lp = Cc["@mozilla.org/file/local;1"]
- .createInstance(Ci.nsILocalFile);
- lp.initWithPath(basePath);
- }
-
- // if you're running this, you probably want to see debugging info
- DEBUG = true;
-
- var srv = new nsHttpServer();
- if (lp)
- srv.registerDirectory("/", lp);
- srv.registerContentType("sjs", SJS_TYPE);
- srv.identity.setPrimary("http", "localhost", port);
- srv.start(port);
-
- var thread = gThreadManager.currentThread;
- while (!srv.isStopped())
- thread.processNextEvent(true);
-
- // get rid of any pending requests
- while (thread.hasPendingEvents())
- thread.processNextEvent(true);
-
- DEBUG = false;
-}
-
-function getServer (port, basePath) {
- if (basePath) {
- var lp = Cc["@mozilla.org/file/local;1"]
- .createInstance(Ci.nsILocalFile);
- lp.initWithPath(basePath);
- }
-
- var srv = new nsHttpServer();
- if (lp)
- srv.registerDirectory("/", lp);
- srv.registerContentType("sjs", SJS_TYPE);
- srv.identity.setPrimary("http", "localhost", port);
- srv._port = port;
-
- return srv;
-}
deleted file mode 100644
--- a/mail/test/resources/mozmill/mozmill/extension/resource/stdlib/json2.js
+++ /dev/null
@@ -1,469 +0,0 @@
-/*
- http://www.JSON.org/json2.js
- 2008-05-25
-
- Public Domain.
-
- NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
-
- See http://www.JSON.org/js.html
-
- This file creates a global JSON object containing two methods: stringify
- and parse.
-
- JSON.stringify(value, replacer, space)
- value any JavaScript value, usually an object or array.
-
- replacer an optional parameter that determines how object
- values are stringified for objects without a toJSON
- method. It can be a function or an array.
-
- space an optional parameter that specifies the indentation
- of nested structures. If it is omitted, the text will
- be packed without extra whitespace. If it is a number,
- it will specify the number of spaces to indent at each
- level. If it is a string (such as '\t' or ' '),
- it contains the characters used to indent at each level.
-
- This method produces a JSON text from a JavaScript value.
-
- When an object value is found, if the object contains a toJSON
- method, its toJSON method will be called and the result will be
- stringified. A toJSON method does not serialize: it returns the
- value represented by the name/value pair that should be serialized,
- or undefined if nothing should be serialized. The toJSON method
- will be passed the key associated with the value, and this will be
- bound to the object holding the key.
-
- For example, this would serialize Dates as ISO strings.
-
- Date.prototype.toJSON = function (key) {
- function f(n) {
- // Format integers to have at least two digits.
- return n < 10 ? '0' + n : n;
- }
-
- return this.getUTCFullYear() + '-' +
- f(this.getUTCMonth() + 1) + '-' +
- f(this.getUTCDate()) + 'T' +
- f(this.getUTCHours()) + ':' +
- f(this.getUTCMinutes()) + ':' +
- f(this.getUTCSeconds()) + 'Z';
- };
-
- You can provide an optional replacer method. It will be passed the
- key and value of each member, with this bound to the containing
- object. The value that is returned from your method will be
- serialized. If your method returns undefined, then the member will
- be excluded from the serialization.
-
- If the replacer parameter is an array, then it will be used to
- select the members to be serialized. It filters the results such
- that only members with keys listed in the replacer array are
- stringified.
-
- Values that do not have JSON representations, such as undefined or
- functions, will not be serialized. Such values in objects will be
- dropped; in arrays they will be replaced with null. You can use
- a replacer function to replace those with JSON values.
- JSON.stringify(undefined) returns undefined.
-
- The optional space parameter produces a stringification of the
- value that is filled with line breaks and indentation to make it
- easier to read.
-
- If the space parameter is a non-empty string, then that string will
- be used for indentation. If the space parameter is a number, then
- the indentation will be that many spaces.
-
- Example:
-
- text = JSON.stringify(['e', {pluribus: 'unum'}]);
- // text is '["e",{"pluribus":"unum"}]'
-
-
- text = JSON.stringify(['e', {pluribus: 'unum'}], null, '\t');
- // text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]'
-
- text = JSON.stringify([new Date()], function (key, value) {
- return this[key] instanceof Date ?
- 'Date(' + this[key] + ')' : value;
- });
- // text is '["Date(---current time---)"]'
-
-
- JSON.parse(text, reviver)
- This method parses a JSON text to produce an object or array.
- It can throw a SyntaxError exception.
-
- The optional reviver parameter is a function that can filter and
- transform the results. It receives each of the keys and values,
- and its return value is used instead of the original value.
- If it returns what it received, then the structure is not modified.
- If it returns undefined then the member is deleted.
-
- Example:
-
- // Parse the text. Values that look like ISO date strings will
- // be converted to Date objects.
-
- myData = JSON.parse(text, function (key, value) {
- var a;
- if (typeof value === 'string') {
- a =
-/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value);
- if (a) {
- return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4],
- +a[5], +a[6]));
- }
- }
- return value;
- });
-
- myData = JSON.parse('["Date(09/09/2001)"]', function (key, value) {
- var d;
- if (typeof value === 'string' &&
- value.slice(0, 5) === 'Date(' &&
- value.slice(-1) === ')') {
- d = new Date(value.slice(5, -1));
- if (d) {
- return d;
- }
- }
- return value;
- });
-
-
- This is a reference implementation. You are free to copy, modify, or
- redistribute.
-
- This code should be minified before deployment.
- See http://javascript.crockford.com/jsmin.html
-
- USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO
- NOT CONTROL.
-*/
-
-/*jslint evil: true */
-
-/*global JSON */
-
-/*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", call,
- charCodeAt, getUTCDate, getUTCFullYear, getUTCHours, getUTCMinutes,
- getUTCMonth, getUTCSeconds, hasOwnProperty, join, lastIndex, length,
- parse, propertyIsEnumerable, prototype, push, replace, slice, stringify,
- test, toJSON, toString
-*/
-
-var EXPORTED_SYMBOLS = ["JSON"];
-
-// Create a JSON object only if one does not already exist. We create the
-// object in a closure to avoid creating global variables.
-
- JSON = function () {
-
- function f(n) {
- // Format integers to have at least two digits.
- return n < 10 ? '0' + n : n;
- }
-
- Date.prototype.toJSON = function (key) {
-
- return this.getUTCFullYear() + '-' +
- f(this.getUTCMonth() + 1) + '-' +
- f(this.getUTCDate()) + 'T' +
- f(this.getUTCHours()) + ':' +
- f(this.getUTCMinutes()) + ':' +
- f(this.getUTCSeconds()) + 'Z';
- };
-
- var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
- escapeable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
- gap,
- indent,
- meta = { // table of character substitutions
- '\b': '\\b',
- '\t': '\\t',
- '\n': '\\n',
- '\f': '\\f',
- '\r': '\\r',
- '"' : '\\"',
- '\\': '\\\\'
- },
- rep;
-
-
- function quote(string) {
-
-// If the string contains no control characters, no quote characters, and no
-// backslash characters, then we can safely slap some quotes around it.
-// Otherwise we must also replace the offending characters with safe escape
-// sequences.
-
- escapeable.lastIndex = 0;
- return escapeable.test(string) ?
- '"' + string.replace(escapeable, function (a) {
- var c = meta[a];
- if (typeof c === 'string') {
- return c;
- }
- return '\\u' + ('0000' +
- (+(a.charCodeAt(0))).toString(16)).slice(-4);
- }) + '"' :
- '"' + string + '"';
- }
-
-
- function str(key, holder) {
-
-// Produce a string from holder[key].
-
- var i, // The loop counter.
- k, // The member key.
- v, // The member value.
- length,
- mind = gap,
- partial,
- value = holder[key];
-
-// If the value has a toJSON method, call it to obtain a replacement value.
-
- if (value && typeof value === 'object' &&
- typeof value.toJSON === 'function') {
- value = value.toJSON(key);
- }
-
-// If we were called with a replacer function, then call the replacer to
-// obtain a replacement value.
-
- if (typeof rep === 'function') {
- value = rep.call(holder, key, value);
- }
-
-// What happens next depends on the value's type.
-
- switch (typeof value) {
- case 'string':
- return quote(value);
-
- case 'number':
-
-// JSON numbers must be finite. Encode non-finite numbers as null.
-
- return isFinite(value) ? String(value) : 'null';
-
- case 'boolean':
- case 'null':
-
-// If the value is a boolean or null, convert it to a string. Note:
-// typeof null does not produce 'null'. The case is included here in
-// the remote chance that this gets fixed someday.
-
- return String(value);
-
-// If the type is 'object', we might be dealing with an object or an array or
-// null.
-
- case 'object':
-
-// Due to a specification blunder in ECMAScript, typeof null is 'object',
-// so watch out for that case.
-
- if (!value) {
- return 'null';
- }
-
-// Make an array to hold the partial results of stringifying this object value.
-
- gap += indent;
- partial = [];
-
-// If the object has a dontEnum length property, we'll treat it as an array.
-
- if (typeof value.length === 'number' &&
- !(value.propertyIsEnumerable('length'))) {
-
-// The object is an array. Stringify every element. Use null as a placeholder
-// for non-JSON values.
-
- length = value.length;
- for (i = 0; i < length; i += 1) {
- partial[i] = str(i, value) || 'null';
- }
-
-// Join all of the elements together, separated with commas, and wrap them in
-// brackets.
-
- v = partial.length === 0 ? '[]' :
- gap ? '[\n' + gap +
- partial.join(',\n' + gap) + '\n' +
- mind + ']' :
- '[' + partial.join(',') + ']';
- gap = mind;
- return v;
- }
-
-// If the replacer is an array, use it to select the members to be stringified.
-
- if (rep && typeof rep === 'object') {
- length = rep.length;
- for (i = 0; i < length; i += 1) {
- k = rep[i];
- if (typeof k === 'string') {
- v = str(k, value, rep);
- if (v) {
- partial.push(quote(k) + (gap ? ': ' : ':') + v);
- }
- }
- }
- } else {
-
-// Otherwise, iterate through all of the keys in the object.
-
- for (k in value) {
- if (Object.hasOwnProperty.call(value, k)) {
- v = str(k, value, rep);
- if (v) {
- partial.push(quote(k) + (gap ? ': ' : ':') + v);
- }
- }
- }
- }
-
-// Join all of the member texts together, separated with commas,
-// and wrap them in braces.
-
- v = partial.length === 0 ? '{}' :
- gap ? '{\n' + gap + partial.join(',\n' + gap) + '\n' +
- mind + '}' : '{' + partial.join(',') + '}';
- gap = mind;
- return v;
- }
- }
-
-// Return the JSON object containing the stringify and parse methods.
-
- return {
- stringify: function (value, replacer, space) {
-
-// The stringify method takes a value and an optional replacer, and an optional
-// space parameter, and returns a JSON text. The replacer can be a function
-// that can replace values, or an array of strings that will select the keys.
-// A default replacer method can be provided. Use of the space parameter can
-// produce text that is more easily readable.
-
- var i;
- gap = '';
- indent = '';
-
-// If the space parameter is a number, make an indent string containing that
-// many spaces.
-
- if (typeof space === 'number') {
- for (i = 0; i < space; i += 1) {
- indent += ' ';
- }
-
-// If the space parameter is a string, it will be used as the indent string.
-
- } else if (typeof space === 'string') {
- indent = space;
- }
-
-// If there is a replacer, it must be a function or an array.
-// Otherwise, throw an error.
-
- rep = replacer;
- if (replacer && typeof replacer !== 'function' &&
- (typeof replacer !== 'object' ||
- typeof replacer.length !== 'number')) {
- throw new Error('JSON.stringify');
- }
-
-// Make a fake root object containing our value under the key of ''.
-// Return the result of stringifying the value.
-
- return str('', {'': value});
- },
-
-
- parse: function (text, reviver) {
-
-// The parse method takes a text and an optional reviver function, and returns
-// a JavaScript value if the text is a valid JSON text.
-
- var j;
-
- function walk(holder, key) {
-
-// The walk method is used to recursively walk the resulting structure so
-// that modifications can be made.
-
- var k, v, value = holder[key];
- if (value && typeof value === 'object') {
- for (k in value) {
- if (Object.hasOwnProperty.call(value, k)) {
- v = walk(value, k);
- if (v !== undefined) {
- value[k] = v;
- } else {
- delete value[k];
- }
- }
- }
- }
- return reviver.call(holder, key, value);
- }
-
-
-// Parsing happens in four stages. In the first stage, we replace certain
-// Unicode characters with escape sequences. JavaScript handles many characters
-// incorrectly, either silently deleting them, or treating them as line endings.
-
- cx.lastIndex = 0;
- if (cx.test(text)) {
- text = text.replace(cx, function (a) {
- return '\\u' + ('0000' +
- (+(a.charCodeAt(0))).toString(16)).slice(-4);
- });
- }
-
-// In the second stage, we run the text against regular expressions that look
-// for non-JSON patterns. We are especially concerned with '()' and 'new'
-// because they can cause invocation, and '=' because it can cause mutation.
-// But just to be safe, we want to reject all unexpected forms.
-
-// We split the second stage into 4 regexp operations in order to work around
-// crippling inefficiencies in IE's and Safari's regexp engines. First we
-// replace the JSON backslash pairs with '@' (a non-JSON character). Second, we
-// replace all simple value tokens with ']' characters. Third, we delete all
-// open brackets that follow a colon or comma or that begin the text. Finally,
-// we look to see that the remaining characters are only whitespace or ']' or
-// ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval.
-
- if (/^[\],:{}\s]*$/.
-test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@').
-replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']').
-replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
-
-// In the third stage we use the eval function to compile the text into a
-// JavaScript structure. The '{' operator is subject to a syntactic ambiguity
-// in JavaScript: it can begin a block or an object literal. We wrap the text
-// in parens to eliminate the ambiguity.
-
- j = eval('(' + text + ')');
-
-// In the optional fourth stage, we recursively walk the new structure, passing
-// each name/value pair to a reviver function for possible transformation.
-
- return typeof reviver === 'function' ?
- walk({'': j}, '') : j;
- }
-
-// If the text is not JSON parseable, then a SyntaxError is thrown.
-
- throw new SyntaxError('JSON.parse');
- }
- };
- }();
-
deleted file mode 100644
--- a/mail/test/resources/mozmill/mozmill/extension/resource/stdlib/objects.js
+++ /dev/null
@@ -1,86 +0,0 @@
-// ***** BEGIN LICENSE BLOCK *****// ***** BEGIN LICENSE BLOCK *****
-// Version: MPL 1.1/GPL 2.0/LGPL 2.1
-//
-// The contents of this file are subject to the Mozilla Public License Version
-// 1.1 (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-// http://www.mozilla.org/MPL/
-//
-// Software distributed under the License is distributed on an "AS IS" basis,
-// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-// for the specific language governing rights and limitations under the
-// License.
-//
-// The Original Code is Mozilla Corporation Code.
-//
-// The Initial Developer of the Original Code is
-// Mikeal Rogers.
-// Portions created by the Initial Developer are Copyright (C) 2008
-// the Initial Developer. All Rights Reserved.
-//
-// Contributor(s):
-// Mikeal Rogers <mikeal.rogers@gmail.com>
-//
-// Alternatively, the contents of this file may be used under the terms of
-// either the GNU General Public License Version 2 or later (the "GPL"), or
-// the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-// in which case the provisions of the GPL or the LGPL are applicable instead
-// of those above. If you wish to allow use of your version of this file only
-// under the terms of either the GPL or the LGPL, and not to allow others to
-// use your version of this file under the terms of the MPL, indicate your
-// decision by deleting the provisions above and replace them with the notice
-// and other provisions required by the GPL or the LGPL. If you do not delete
-// the provisions above, a recipient may use your version of this file under
-// the terms of any one of the MPL, the GPL or the LGPL.
-//
-// ***** END LICENSE BLOCK *****
-
-var EXPORTED_SYMBOLS = ['getLength', ];//'compare'];
-
-var getLength = function (obj) {
- var len = 0;
- for (i in obj) {
- len++;
- }
- return len;
-}
-
-// var logging = {}; Components.utils.import('resource://mozmill/stdlib/logging.js', logging);
-
-// var objectsLogger = logging.getLogger('objectsLogger');
-
-// var compare = function (obj1, obj2, depth, recursion) {
-// if (depth == undefined) {
-// var depth = 4;
-// }
-// if (recursion == undefined) {
-// var recursion = 0;
-// }
-//
-// if (recursion > depth) {
-// return true;
-// }
-//
-// if (typeof(obj1) != typeof(obj2)) {
-// return false;
-// }
-//
-// if (typeof(obj1) == "object" && typeof(obj2) == "object") {
-// if ([x for (x in obj1)].length != [x for (x in obj2)].length) {
-// return false;
-// }
-// for (i in obj1) {
-// recursion++;
-// var result = compare(obj1[i], obj2[i], depth, recursion);
-// objectsLogger.info(i+' in recursion '+result);
-// if (result == false) {
-// return false;
-// }
-// }
-// } else {
-// if (obj1 != obj2) {
-// return false;
-// }
-// }
-// return true;
-// }
deleted file mode 100644
--- a/mail/test/resources/mozmill/mozmill/extension/resource/stdlib/os.js
+++ /dev/null
@@ -1,86 +0,0 @@
-// ***** BEGIN LICENSE BLOCK *****// ***** BEGIN LICENSE BLOCK *****
-// Version: MPL 1.1/GPL 2.0/LGPL 2.1
-//
-// The contents of this file are subject to the Mozilla Public License Version
-// 1.1 (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-// http://www.mozilla.org/MPL/
-//
-// Software distributed under the License is distributed on an "AS IS" basis,
-// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-// for the specific language governing rights and limitations under the
-// License.
-//
-// The Original Code is Mozilla Corporation Code.
-//
-// The Initial Developer of the Original Code is
-// Mikeal Rogers.
-// Portions created by the Initial Developer are Copyright (C) 2008
-// the Initial Developer. All Rights Reserved.
-//
-// Contributor(s):
-// Mikeal Rogers <mikeal.rogers@gmail.com>
-//
-// Alternatively, the contents of this file may be used under the terms of
-// either the GNU General Public License Version 2 or later (the "GPL"), or
-// the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-// in which case the provisions of the GPL or the LGPL are applicable instead
-// of those above. If you wish to allow use of your version of this file only
-// under the terms of either the GPL or the LGPL, and not to allow others to
-// use your version of this file under the terms of the MPL, indicate your
-// decision by deleting the provisions above and replace them with the notice
-// and other provisions required by the GPL or the LGPL. If you do not delete
-// the provisions above, a recipient may use your version of this file under
-// the terms of any one of the MPL, the GPL or the LGPL.
-//
-// ***** END LICENSE BLOCK *****
-
-var EXPORTED_SYMBOLS = ['listDirectory', 'getFileForPath', 'abspath', 'getPlatform'];
-
-function listDirectory (file) {
- // file is the given directory (nsIFile)
- var entries = file.directoryEntries;
- var array = [];
- while (entries.hasMoreElements())
- {
- var entry = entries.getNext();
- entry.QueryInterface(Components.interfaces.nsIFile);
- array.push(entry);
- }
- return array;
-}
-
-function getFileForPath (path) {
- var file = Components.classes["@mozilla.org/file/local;1"]
- .createInstance(Components.interfaces.nsILocalFile);
- file.initWithPath(path);
- return file;
-}
-
-function abspath (rel, file) {
- var relSplit = rel.split('/');
- if (relSplit[0] == '..' && !file.isDirectory()) {
- file = file.parent;
- }
- for each(p in relSplit) {
- if (p == '..') {
- file = file.parent;
- } else if (p == '.'){
- if (!file.isDirectory()) {
- file = file.parent;
- }
- } else {
- file.append(p);
- }
- }
- return file.path;
-}
-
-function getPlatform () {
- var xulRuntime = Components.classes["@mozilla.org/xre/app-info;1"]
- .getService(Components.interfaces.nsIXULRuntime);
- mPlatform = xulRuntime.OS.toLowerCase();
- return mPlatform;
-}
-
-
deleted file mode 100644
--- a/mail/test/resources/mozmill/mozmill/extension/resource/stdlib/securable-module.js
+++ /dev/null
@@ -1,360 +0,0 @@
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Jetpack.
- *
- * The Initial Developer of the Original Code is Mozilla.
- * Portions created by the Initial Developer are Copyright (C) 2007
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- * Atul Varma <atul@mozilla.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-(function(global) {
- const Cc = Components.classes;
- const Ci = Components.interfaces;
- const Cu = Components.utils;
- const Cr = Components.results;
-
- var exports = {};
-
- var ios = Cc['@mozilla.org/network/io-service;1']
- .getService(Ci.nsIIOService);
-
- var systemPrincipal = Cc["@mozilla.org/systemprincipal;1"]
- .createInstance(Ci.nsIPrincipal);
-
- function resolvePrincipal(principal, defaultPrincipal) {
- if (principal === undefined)
- return defaultPrincipal;
- if (principal == "system")
- return systemPrincipal;
- return principal;
- }
-
- // The base URI to we use when we're given relative URLs, if any.
- var baseURI = null;
- if (global.window)
- baseURI = ios.newURI(global.location.href, null, null);
- exports.baseURI = baseURI;
-
- // The "parent" chrome URI to use if we're loading code that
- // needs chrome privileges but may not have a filename that
- // matches any of SpiderMonkey's defined system filename prefixes.
- // The latter is needed so that wrappers can be automatically
- // made for the code. For more information on this, see
- // bug 418356:
- //
- // https://bugzilla.mozilla.org/show_bug.cgi?id=418356
- var parentChromeURIString;
- if (baseURI)
- // We're being loaded from a chrome-privileged document, so
- // use its URL as the parent string.
- parentChromeURIString = baseURI.spec;
- else
- // We're being loaded from a chrome-privileged JS module or
- // SecurableModule, so use its filename (which may itself
- // contain a reference to a parent).
- parentChromeURIString = Components.stack.filename;
-
- function maybeParentifyFilename(filename) {
- var doParentifyFilename = true;
- try {
- // TODO: Ideally we should just make
- // nsIChromeRegistry.wrappersEnabled() available from script
- // and use it here. Until that's in the platform, though,
- // we'll play it safe and parentify the filename unless
- // we're absolutely certain things will be ok if we don't.
- var filenameURI = ios.newURI(options.filename,
- null,
- baseURI);
- if (filenameURI.scheme == 'chrome' &&
- filenameURI.path.indexOf('/content/') == 0)
- // Content packages will always have wrappers made for them;
- // if automatic wrappers have been disabled for the
- // chrome package via a chrome manifest flag, then
- // this still works too, to the extent that the
- // content package is insecure anyways.
- doParentifyFilename = false;
- } catch (e) {}
- if (doParentifyFilename)
- return parentChromeURIString + " -> " + filename;
- return filename;
- }
-
- function getRootDir(urlStr) {
- // TODO: This feels hacky, and like there will be edge cases.
- return urlStr.slice(0, urlStr.lastIndexOf("/") + 1);
- }
-
- exports.SandboxFactory = function SandboxFactory(defaultPrincipal) {
- // Unless specified otherwise, use a principal with limited
- // privileges.
- this._defaultPrincipal = resolvePrincipal(defaultPrincipal,
- "http://www.mozilla.org");
- },
-
- exports.SandboxFactory.prototype = {
- createSandbox: function createSandbox(options) {
- var principal = resolvePrincipal(options.principal,
- this._defaultPrincipal);
-
- return {
- _sandbox: new Cu.Sandbox(principal),
- _principal: principal,
- get globalScope() {
- return this._sandbox;
- },
- defineProperty: function defineProperty(name, value) {
- this._sandbox[name] = value;
- },
- getProperty: function getProperty(name) {
- return this._sandbox[name];
- },
- evaluate: function evaluate(options) {
- if (typeof(options) == 'string')
- options = {contents: options};
- options = {__proto__: options};
- if (typeof(options.contents) != 'string')
- throw new Error('Expected string for options.contents');
- if (options.lineNo === undefined)
- options.lineNo = 1;
- if (options.jsVersion === undefined)
- options.jsVersion = "1.8";
- if (typeof(options.filename) != 'string')
- options.filename = '<string>';
-
- if (this._principal == systemPrincipal)
- options.filename = maybeParentifyFilename(options.filename);
-
- return Cu.evalInSandbox(options.contents,
- this._sandbox,
- options.jsVersion,
- options.filename,
- options.lineNo);
- }
- };
- }
- };
-
- exports.Loader = function Loader(options) {
- options = {__proto__: options};
- if (options.fs === undefined) {
- var rootPaths = options.rootPath || options.rootPaths;
- if (rootPaths) {
- if (rootPaths.constructor.name != "Array")
- rootPaths = [rootPaths];
- var fses = [new exports.LocalFileSystem(path)
- for each (path in rootPaths)];
- options.fs = new exports.CompositeFileSystem(fses);
- } else
- options.fs = new exports.LocalFileSystem();
- }
- if (options.sandboxFactory === undefined)
- options.sandboxFactory = new exports.SandboxFactory(
- options.defaultPrincipal
- );
- if (options.modules === undefined)
- options.modules = {};
- if (options.globals === undefined)
- options.globals = {};
-
- this.fs = options.fs;
- this.sandboxFactory = options.sandboxFactory;
- this.sandboxes = {};
- this.modules = options.modules;
- this.globals = options.globals;
- };
-
- exports.Loader.prototype = {
- _makeRequire: function _makeRequire(rootDir) {
- var self = this;
- return function require(module) {
- if (module == "chrome") {
- var chrome = { Cc: Components.classes,
- Ci: Components.interfaces,
- Cu: Components.utils,
- Cr: Components.results,
- Cm: Components.manager,
- components: Components
- };
- return chrome;
- }
- var path = self.fs.resolveModule(rootDir, module);
- if (!path)
- throw new Error('Module "' + module + '" not found');
- if (!(path in self.modules)) {
- var options = self.fs.getFile(path);
- if (options.filename === undefined)
- options.filename = path;
-
- var exports = {};
- var sandbox = self.sandboxFactory.createSandbox(options);
- self.sandboxes[path] = sandbox;
- for (name in self.globals)
- sandbox.defineProperty(name, self.globals[name]);
- sandbox.defineProperty('require', self._makeRequire(path));
- sandbox.evaluate("var exports = {};");
- let ES5 = self.modules.es5;
- if (ES5) {
- let { Object, Array, Function } = sandbox.globalScope;
- ES5.init(Object, Array, Function);
- }
- self.modules[path] = sandbox.getProperty("exports");
- sandbox.evaluate(options);
- }
- return self.modules[path];
- };
- },
-
- // This is only really used by unit tests and other
- // development-related facilities, allowing access to symbols
- // defined in the global scope of a module.
- findSandboxForModule: function findSandboxForModule(module) {
- var path = this.fs.resolveModule(null, module);
- if (!path)
- throw new Error('Module "' + module + '" not found');
- if (!(path in this.sandboxes))
- this.require(module);
- if (!(path in this.sandboxes))
- throw new Error('Internal error: path not in sandboxes: ' +
- path);
- return this.sandboxes[path];
- },
-
- require: function require(module) {
- return (this._makeRequire(null))(module);
- },
-
- runScript: function runScript(options, extraOutput) {
- if (typeof(options) == 'string')
- options = {contents: options};
- options = {__proto__: options};
- var sandbox = this.sandboxFactory.createSandbox(options);
- if (extraOutput)
- extraOutput.sandbox = sandbox;
- for (name in this.globals)
- sandbox.defineProperty(name, this.globals[name]);
- sandbox.defineProperty('require', this._makeRequire(null));
- return sandbox.evaluate(options);
- }
- };
-
- exports.CompositeFileSystem = function CompositeFileSystem(fses) {
- this.fses = fses;
- this._pathMap = {};
- };
-
- exports.CompositeFileSystem.prototype = {
- resolveModule: function resolveModule(base, path) {
- for (var i = 0; i < this.fses.length; i++) {
- var fs = this.fses[i];
- var absPath = fs.resolveModule(base, path);
- if (absPath) {
- this._pathMap[absPath] = fs;
- return absPath;
- }
- }
- return null;
- },
- getFile: function getFile(path) {
- return this._pathMap[path].getFile(path);
- }
- };
-
- exports.LocalFileSystem = function LocalFileSystem(root) {
- if (root === undefined) {
- if (!baseURI)
- throw new Error("Need a root path for module filesystem");
- root = baseURI;
- }
- if (typeof(root) == 'string')
- root = ios.newURI(root, null, baseURI);
- if (root instanceof Ci.nsIFile)
- root = ios.newFileURI(root);
- if (!(root instanceof Ci.nsIURI))
- throw new Error('Expected nsIFile, nsIURI, or string for root');
-
- this.root = root.spec;
- this._rootURI = root;
- this._rootURIDir = getRootDir(root.spec);
- };
-
- exports.LocalFileSystem.prototype = {
- resolveModule: function resolveModule(base, path) {
- path = path + ".js";
-
- var baseURI;
- if (!base)
- baseURI = this._rootURI;
- else
- baseURI = ios.newURI(base, null, null);
- var newURI = ios.newURI(path, null, baseURI);
- var channel = ios.newChannelFromURI(newURI);
- try {
- channel.open().close();
- } catch (e if e.result == Cr.NS_ERROR_FILE_NOT_FOUND) {
- return null;
- }
- return newURI.spec;
- },
- getFile: function getFile(path) {
- var channel = ios.newChannel(path, null, null);
- var iStream = channel.open();
- var ciStream = Cc["@mozilla.org/intl/converter-input-stream;1"].
- createInstance(Ci.nsIConverterInputStream);
- var bufLen = 0x8000;
- ciStream.init(iStream, "UTF-8", bufLen,
- Ci.nsIConverterInputStream.DEFAULT_REPLACEMENT_CHARACTER);
- var chunk = {};
- var data = "";
- while (ciStream.readString(bufLen, chunk) > 0)
- data += chunk.value;
- ciStream.close();
- iStream.close();
- return {contents: data};
- }
- };
-
- if (global.window) {
- // We're being loaded in a chrome window, or a web page with
- // UniversalXPConnect privileges.
- global.SecurableModule = exports;
- } else if (global.exports) {
- // We're being loaded in a SecurableModule.
- for (name in exports) {
- global.exports[name] = exports[name];
- }
- } else {
- // We're being loaded in a JS module.
- global.EXPORTED_SYMBOLS = [];
- for (name in exports) {
- global.EXPORTED_SYMBOLS.push(name);
- global[name] = exports[name];
- }
- }
- })(this);
deleted file mode 100644
--- a/mail/test/resources/mozmill/mozmill/extension/resource/stdlib/strings.js
+++ /dev/null
@@ -1,50 +0,0 @@
-// ***** BEGIN LICENSE BLOCK *****// ***** BEGIN LICENSE BLOCK *****
-// Version: MPL 1.1/GPL 2.0/LGPL 2.1
-//
-// The contents of this file are subject to the Mozilla Public License Version
-// 1.1 (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-// http://www.mozilla.org/MPL/
-//
-// Software distributed under the License is distributed on an "AS IS" basis,
-// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-// for the specific language governing rights and limitations under the
-// License.
-//
-// The Original Code is Mozilla Corporation Code.
-//
-// The Initial Developer of the Original Code is
-// Mikeal Rogers.
-// Portions created by the Initial Developer are Copyright (C) 2008
-// the Initial Developer. All Rights Reserved.
-//
-// Contributor(s):
-// Mikeal Rogers <mikeal.rogers@gmail.com>
-//
-// Alternatively, the contents of this file may be used under the terms of
-// either the GNU General Public License Version 2 or later (the "GPL"), or
-// the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-// in which case the provisions of the GPL or the LGPL are applicable instead
-// of those above. If you wish to allow use of your version of this file only
-// under the terms of either the GPL or the LGPL, and not to allow others to
-// use your version of this file under the terms of the MPL, indicate your
-// decision by deleting the provisions above and replace them with the notice
-// and other provisions required by the GPL or the LGPL. If you do not delete
-// the provisions above, a recipient may use your version of this file under
-// the terms of any one of the MPL, the GPL or the LGPL.
-//
-// ***** END LICENSE BLOCK *****
-
-var EXPORTED_SYMBOLS = ['trim', 'vslice'];
-
-var arrays = {}; Components.utils.import('resource://mozmill/stdlib/arrays.js', arrays);
-
-var trim = function (str) {
- return (str.replace(/^[\s\xA0]+/, "").replace(/[\s\xA0]+$/, ""));
-}
-
-var vslice = function (str, svalue, evalue) {
- var sindex = arrays.indexOf(str, svalue);
- var eindex = arrays.rindexOf(str, evalue);
- return str.slice(sindex + 1, eindex);
-}
\ No newline at end of file
deleted file mode 100644
--- a/mail/test/resources/mozmill/mozmill/extension/resource/stdlib/withs.js
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- Copyright (c) 2006 Lawrence Oluyede <l.oluyede@gmail.com>
-
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in all
- copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- SOFTWARE.
-*/
-
-/*
- startsWith(str, prefix[, start[, end]]) -> bool
-
- Return true if str ends with the specified prefix, false otherwise.
- With optional start, test str beginning at that position.
- With optional end, stop comparing str at that position.
- prefix can also be an array of strings to try.
-*/
-
-var EXPORTED_SYMBOLS = ['startsWith', 'endsWith'];
-
-function startsWith(str, prefix, start, end) {
- if (arguments.length < 2) {
- throw new TypeError('startsWith() requires at least 2 arguments');
- }
-
- // check if start and end are null/undefined or a 'number'
- if ((start == null) || (isNaN(new Number(start)))) {
- start = 0;
- }
- if ((end == null) || (isNaN(new Number(end)))) {
- end = Number.MAX_VALUE;
- }
-
- // if it's an array
- if (typeof prefix == "object") {
- for (var i = 0, j = prefix.length; i < j; i++) {
- var res = _stringTailMatch(str, prefix[i], start, end, true);
- if (res) {
- return true;
- }
- }
- return false;
- }
-
- return _stringTailMatch(str, prefix, start, end, true);
-}
-
-/*
- endsWith(str, suffix[, start[, end]]) -> bool
-
- Return true if str ends with the specified suffix, false otherwise.
- With optional start, test str beginning at that position.
- With optional end, stop comparing str at that position.
- suffix can also be an array of strings to try.
-*/
-function endsWith(str, suffix, start, end) {
- if (arguments.length < 2) {
- throw new TypeError('endsWith() requires at least 2 arguments');
- }
-
- // check if start and end are null/undefined or a 'number'
- if ((start == null) || (isNaN(new Number(start)))) {
- start = 0;
- }
- if ((end == null) || (isNaN(new Number(end)))) {
- end = Number.MAX_VALUE;
- }
-
- // if it's an array
- if (typeof suffix == "object") {
- for (var i = 0, j = suffix.length; i < j; i++) {
- var res = _stringTailMatch(str, suffix[i], start, end, false);
- if (res) {
- return true;
- }
- }
- return false;
- }
-
- return _stringTailMatch(str, suffix, start, end, false);
-}
-
-/*
- Matches the end (direction == false) or start (direction == true) of str
- against substr, using the start and end arguments. Returns false
- if not found and true if found.
-*/
-function _stringTailMatch(str, substr, start, end, fromStart) {
- var len = str.length;
- var slen = substr.length;
-
- var indices = _adjustIndices(start, end, len);
- start = indices[0]; end = indices[1]; len = indices[2];
-
- if (fromStart) {
- if (start + slen > len) {
- return false;
- }
- } else {
- if (end - start < slen || start > len) {
- return false;
- }
- if (end - slen > start) {
- start = end - slen;
- }
- }
-
- if (end - start >= slen) {
- return str.substr(start, slen) == substr;
- }
- return false;
-}
-
-function _adjustIndices(start, end, len)
-{
- if (end > len) {
- end = len;
- } else if (end < 0) {
- end += len;
- }
-
- if (end < 0) {
- end = 0;
- }
- if (start < 0) {
- start += len;
- }
- if (start < 0) {
- start = 0;
- }
-
- return [start, end, len];
-}
deleted file mode 100644
--- a/mail/test/resources/mozmill/mozmill/extension/skin/chrome.css
+++ /dev/null
@@ -1,9 +0,0 @@
-#mozmill-window {
- /* bug 529589 - Iframe inside a chrome window does not repaint until another window is focused */
- background: white !important;
-}
-
-#mozmill-window iframe {
- border: none;
- overflow: hidden;
-}
deleted file mode 100644
--- a/mail/test/resources/mozmill/mozmill/extension/zipexclude.lst
+++ /dev/null
@@ -1,3 +0,0 @@
-*.svn*
-*.DS_Store*
-zipexclude.lst
deleted file mode 100644
--- a/mail/test/resources/mozmill/patches/eventUtils.patch
+++ /dev/null
@@ -1,218 +0,0 @@
-diff --git a/mozmill/mozmill/extension/resource/stdlib/EventUtils.js b/mozmill/mozmill/extension/resource/stdlib/EventUtils.js
-index 27fbbc7..0329d47 100644
---- a/mozmill/mozmill/extension/resource/stdlib/EventUtils.js
-+++ b/mozmill/mozmill/extension/resource/stdlib/EventUtils.js
-@@ -1,3 +1,24 @@
-+// Export all available functions for Mozmill
-+var EXPORTED_SYMBOLS = ["sendMouseEvent", "sendChar", "sendString", "sendKey",
-+ "__doEventDispatch", "_parseModifiers", "synthesizeMouse",
-+ "synthesizeMouseScroll", "synthesizeKey", "_expectEvent",
-+ "_checkExpectedEvent", "synthesizeMouseExpectEvent",
-+ "synthesizeDragStart", "synthesizeDrop",
-+ "disableNonTestMouseEvents", "_getDOMWindowUtils",
-+ "synthesizeComposition", "synthesizeText",
-+ "synthesizeQuerySelectedText", "synthesizeQueryTextContent",
-+ "synthesizeQueryCaretRect", "synthesizeQueryTextRect",
-+ "synthesizeQueryEditorRect", "synthesizeCharAtPoint",
-+ "synthesizeSelectionSet"];
-+
-+/**
-+ * Get the array with available key events
-+ */
-+function getKeyEvent(aWindow) {
-+ var win = aWindow.wrappedJSObject ? aWindow.wrappedJSObject : aWindow;
-+ return win.KeyEvent;
-+}
-+
- /**
- * EventUtils provides some utility methods for creating and sending DOM events.
- * Current methods:
-@@ -29,9 +50,6 @@ function sendMouseEvent(aEvent, aTarget, aWindow) {
- aTarget = aWindow.document.getElementById(aTarget);
- }
-
-- // For events to trigger the UA's default actions they need to be "trusted"
-- netscape.security.PrivilegeManager.enablePrivilege('UniversalBrowserWrite');
--
- var event = aWindow.document.createEvent('MouseEvent');
-
- var typeArg = aEvent.type;
-@@ -107,14 +125,17 @@ function sendString(aStr, aTarget) {
- * Returns true if the keypress event was accepted (no calls to preventDefault
- * or anything like that), false otherwise.
- */
--function sendKey(aKey, aTarget) {
-+function sendKey(aKey, aTarget, aWindow) {
-+ if (!aWindow)
-+ aWindow = window;
-+
- keyName = "DOM_VK_" + aKey.toUpperCase();
-
-- if (!KeyEvent[keyName]) {
-+ if (!getKeyEvent(aWindow)[keyName]) {
- throw "Unknown key: " + keyName;
- }
-
-- return __doEventDispatch(aTarget, 0, KeyEvent[keyName], false);
-+ return __doEventDispatch(aTarget, 0, getKeyEvent(aWindow)[keyName], false);
- }
-
- /**
-@@ -130,9 +151,6 @@ function __doEventDispatch(aTarget, aCharCode, aKeyCode, aHasShift) {
- aTarget = "target";
- }
-
-- // Make our events trusted
-- netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
--
- var event = document.createEvent("KeyEvents");
- event.initKeyEvent("keydown", true, true, document.defaultView,
- false, false, aHasShift, false,
-@@ -171,6 +189,10 @@ function __doEventDispatch(aTarget, aCharCode, aKeyCode, aHasShift) {
- */
- function _parseModifiers(aEvent)
- {
-+ var hwindow = Components.classes["@mozilla.org/appshell/appShellService;1"]
-+ .getService(Components.interfaces.nsIAppShellService)
-+ .hiddenDOMWindow;
-+
- const masks = Components.interfaces.nsIDOMNSEvent;
- var mval = 0;
- if (aEvent.shiftKey)
-@@ -182,8 +204,8 @@ function _parseModifiers(aEvent)
- if (aEvent.metaKey)
- mval |= masks.META_MASK;
- if (aEvent.accelKey)
-- mval |= (navigator.platform.indexOf("Mac") >= 0) ? masks.META_MASK :
-- masks.CONTROL_MASK;
-+ mval |= (hwindow.navigator.platform.indexOf("Mac") >= 0) ? masks.META_MASK :
-+ masks.CONTROL_MASK;
-
- return mval;
- }
-@@ -203,8 +225,6 @@ function _parseModifiers(aEvent)
- */
- function synthesizeMouse(aTarget, aOffsetX, aOffsetY, aEvent, aWindow)
- {
-- netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
--
- if (!aWindow)
- aWindow = window;
-
-@@ -253,8 +273,6 @@ function synthesizeMouse(aTarget, aOffsetX, aOffsetY, aEvent, aWindow)
- */
- function synthesizeMouseScroll(aTarget, aOffsetX, aOffsetY, aEvent, aWindow)
- {
-- netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
--
- if (!aWindow)
- aWindow = window;
-
-@@ -302,8 +320,6 @@ function synthesizeMouseScroll(aTarget, aOffsetX, aOffsetY, aEvent, aWindow)
- */
- function synthesizeKey(aKey, aEvent, aWindow)
- {
-- netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
--
- if (!aWindow)
- aWindow = window;
-
-@@ -312,7 +328,7 @@ function synthesizeKey(aKey, aEvent, aWindow)
- if (utils) {
- var keyCode = 0, charCode = 0;
- if (aKey.indexOf("VK_") == 0)
-- keyCode = KeyEvent["DOM_" + aKey];
-+ keyCode = getKeyEvent(aWindow)["DOM_" + aKey];
- else
- charCode = aKey.charCodeAt(0);
-
-@@ -555,8 +571,6 @@ function synthesizeDrop(srcElement, destElement, dragData, dropEffect, aWindow)
-
- function disableNonTestMouseEvents(aDisable)
- {
-- netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
--
- var utils =
- window.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
- getInterface(Components.interfaces.nsIDOMWindowUtils);
-@@ -582,8 +596,6 @@ function _getDOMWindowUtils(aWindow)
- */
- function synthesizeComposition(aIsCompositionStart, aWindow)
- {
-- netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
--
- var utils = _getDOMWindowUtils(aWindow);
- if (!utils) {
- return;
-@@ -635,8 +647,6 @@ function synthesizeComposition(aIsCompositionStart, aWindow)
- */
- function synthesizeText(aEvent, aWindow)
- {
-- netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
--
- var utils = _getDOMWindowUtils(aWindow);
- if (!utils) {
- return;
-@@ -685,8 +695,6 @@ function synthesizeText(aEvent, aWindow)
- */
- function synthesizeQuerySelectedText(aWindow)
- {
-- netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
--
- var utils = _getDOMWindowUtils(aWindow);
- if (!utils) {
- return nsnull;
-@@ -707,8 +715,6 @@ function synthesizeQuerySelectedText(aWindow)
- */
- function synthesizeQueryTextContent(aOffset, aLength, aWindow)
- {
-- netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
--
- var utils = _getDOMWindowUtils(aWindow);
- if (!utils) {
- return nsnull;
-@@ -728,8 +734,6 @@ function synthesizeQueryTextContent(aOffset, aLength, aWindow)
- */
- function synthesizeQueryCaretRect(aOffset, aWindow)
- {
-- netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
--
- var utils = _getDOMWindowUtils(aWindow);
- if (!utils) {
- return nsnull;
-@@ -751,8 +755,6 @@ function synthesizeQueryCaretRect(aOffset, aWindow)
- */
- function synthesizeQueryTextRect(aOffset, aLength, aWindow)
- {
-- netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
--
- var utils = _getDOMWindowUtils(aWindow);
- if (!utils) {
- return nsnull;
-@@ -770,8 +772,6 @@ function synthesizeQueryTextRect(aOffset, aLength, aWindow)
- */
- function synthesizeQueryEditorRect(aWindow)
- {
-- netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
--
- var utils = _getDOMWindowUtils(aWindow);
- if (!utils) {
- return nsnull;
-@@ -789,8 +789,6 @@ function synthesizeQueryEditorRect(aWindow)
- */
- function synthesizeCharAtPoint(aX, aY, aWindow)
- {
-- netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
--
- var utils = _getDOMWindowUtils(aWindow);
- if (!utils) {
- return nsnull;
-@@ -813,8 +811,6 @@ function synthesizeCharAtPoint(aX, aY, aWindow)
- */
- function synthesizeSelectionSet(aOffset, aLength, aReverse, aWindow)
- {
-- netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
--
- var utils = _getDOMWindowUtils(aWindow);
- if (!utils) {
- return false;
deleted file mode 100644
--- a/mail/test/resources/mozmill/patches/httpd.patch
+++ /dev/null
@@ -1,40 +0,0 @@
-diff --git a/mozmill/mozmill/extension/resource/stdlib/httpd.js b/mozmill/mozmill/extension/resource/stdlib/httpd.js
-index cf974b3..35a8d36 100644
---- a/mozmill/mozmill/extension/resource/stdlib/httpd.js
-+++ b/mozmill/mozmill/extension/resource/stdlib/httpd.js
-@@ -48,6 +48,14 @@
-
- Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
-
-+var EXPORTED_SYMBOLS = ['getServer'];
-+
-+/**
-+ * Overwrite both dump functions because we do not wanna have this output for Mozmill
-+ */
-+function dump() {}
-+function dumpn() {}
-+
- const Cc = Components.classes;
- const Ci = Components.interfaces;
- const Cr = Components.results;
-@@ -5173,3 +5181,20 @@ function server(port, basePath)
-
- DEBUG = false;
- }
-+
-+function getServer (port, basePath) {
-+ if (basePath) {
-+ var lp = Cc["@mozilla.org/file/local;1"]
-+ .createInstance(Ci.nsILocalFile);
-+ lp.initWithPath(basePath);
-+ }
-+
-+ var srv = new nsHttpServer();
-+ if (lp)
-+ srv.registerDirectory("/", lp);
-+ srv.registerContentType("sjs", SJS_TYPE);
-+ srv.identity.setPrimary("http", "localhost", port);
-+ srv._port = port;
-+
-+ return srv;
-+}
deleted file mode 100644
--- a/mail/test/resources/mozmill/scripts/songmill.py
+++ /dev/null
@@ -1,17 +0,0 @@
-import os, sys
-
-import jsbridge
-import mozmill
-from jsbridge import global_settings
-from mozrunner import runner
-
-this_dir = os.path.abspath(os.path.dirname(__file__))
-
-def cli():
- global_settings.MOZILLA_BINARY = '/Applications/Songbird.app/Contents/MacOS/songbird'
- global_settings.MOZILLA_DEFAULT_PROFILE = '/Applications/Songbird.app/Contents/Resources/defaults/profile'
- runner.Firefox.name = 'songbird'
- mozmill.main()
-
-if __name__ == "__main__":
- cli()
deleted file mode 100644
--- a/mail/test/resources/mozmill/scripts/sync_dependencies.py
+++ /dev/null
@@ -1,68 +0,0 @@
-# ***** BEGIN LICENSE BLOCK *****
-# Version: MPL 1.1/GPL 2.0/LGPL 2.1
-#
-# The contents of this file are subject to the Mozilla Public License Version
-# 1.1 (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-# http://www.mozilla.org/MPL/
-#
-# Software distributed under the License is distributed on an "AS IS" basis,
-# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-# for the specific language governing rights and limitations under the
-# License.
-#
-# The Original Code is Mozilla Corporation Code.
-#
-# The Initial Developer of the Original Code is the Mozilla Foundation.
-# Portions created by the Initial Developer are Copyright (C) 2010
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-# Henrik Skupin <hskupin@gmail.com>
-#
-# Alternatively, the contents of this file may be used under the terms of
-# either the GNU General Public License Version 2 or later (the "GPL"), or
-# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-# in which case the provisions of the GPL or the LGPL are applicable instead
-# of those above. If you wish to allow use of your version of this file only
-# under the terms of either the GPL or the LGPL, and not to allow others to
-# use your version of this file under the terms of the MPL, indicate your
-# decision by deleting the provisions above and replace them with the notice
-# and other provisions required by the GPL or the LGPL. If you do not delete
-# the provisions above, a recipient may use your version of this file under
-# the terms of any one of the MPL, the GPL or the LGPL.
-#
-# ***** END LICENSE BLOCK *****
-
-import os
-import subprocess
-import urllib
-
-abs_path = os.path.dirname(os.path.abspath(__file__))
-root_path = os.path.dirname(abs_path)
-
-# We need the latest version of Event Utils
-externalModules = [
- { # EventUtils.js
- "url": "http://hg.mozilla.org/mozilla-central/raw-file/default/testing/mochitest/tests/SimpleTest/EventUtils.js",
- "path": "mozmill/extension/resource/stdlib/EventUtils.js",
- "patch": "patches/eventUtils.patch"
- },
- { # httpd.js
- "url": "http://hg.mozilla.org/mozilla-central/raw-file/default/netwerk/test/httpserver/httpd.js",
- "path": "mozmill/extension/resource/stdlib/httpd.js",
- "patch": "patches/httpd.patch"
- }
-]
-
-
-# Change into the root folder to update and patch external modules correctly
-os.chdir(root_path)
-
-for module in externalModules:
- # Retrieve latest EventUtils module and apply our patch
- print "Downloading %s..." % (module["url"])
- urllib.urlretrieve (module["url"], os.path.join(root_path, module["path"]))
-
- print "Patching %s..." % (module["patch"])
- subprocess.call(["git", "apply", module["patch"]])
deleted file mode 100644
--- a/mail/test/resources/mozmill/setup.py
+++ /dev/null
@@ -1,75 +0,0 @@
-# ***** BEGIN LICENSE BLOCK *****
-# Version: MPL 1.1/GPL 2.0/LGPL 2.1
-#
-# The contents of this file are subject to the Mozilla Public License Version
-# 1.1 (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-# http://www.mozilla.org/MPL/
-#
-# Software distributed under the License is distributed on an "AS IS" basis,
-# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-# for the specific language governing rights and limitations under the
-# License.
-#
-# The Original Code is Mozilla Corporation Code.
-#
-# The Initial Developer of the Original Code is
-# Mikeal Rogers.
-# Portions created by the Initial Developer are Copyright (C) 2008
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-# Mikeal Rogers <mikeal.rogers@gmail.com>
-#
-# Alternatively, the contents of this file may be used under the terms of
-# either the GNU General Public License Version 2 or later (the "GPL"), or
-# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-# in which case the provisions of the GPL or the LGPL are applicable instead
-# of those above. If you wish to allow use of your version of this file only
-# under the terms of either the GPL or the LGPL, and not to allow others to
-# use your version of this file under the terms of the MPL, indicate your
-# decision by deleting the provisions above and replace them with the notice
-# and other provisions required by the GPL or the LGPL. If you do not delete
-# the provisions above, a recipient may use your version of this file under
-# the terms of any one of the MPL, the GPL or the LGPL.
-#
-# ***** END LICENSE BLOCK *****
-
-from setuptools import setup, find_packages
-
-desc = """UI Automation tool for Mozilla applications."""
-summ = """A tool for full UI automation of Mozilla applications."""
-
-PACKAGE_NAME = "mozmill"
-PACKAGE_VERSION = "1.5.4b4"
-
-setup(name=PACKAGE_NAME,
- version=PACKAGE_VERSION,
- description=desc,
- long_description=summ,
- author='Mozilla, Mikeal Rogers',
- author_email='mikeal.rogers@gmail.com',
- url='http://github.com/mozautomation/mozmill',
- license='http://www.apache.org/licenses/LICENSE-2.0',
- packages=find_packages(exclude=['test']),
- include_package_data=True,
- package_data = {'': ['*.js', '*.css', '*.html', '*.txt', '*.xpi', '*.rdf', '*.xul', '*.jsm', '*.xml'],},
- zip_safe=False,
- entry_points="""
- [console_scripts]
- mozmill = mozmill:cli
- mozmill-thunderbird = mozmill:tbird_cli
- mozmill-restart = mozmill:restart_cli
- """,
- platforms =['Any'],
- install_requires = ['jsbridge == 2.4.4b4',
- 'mozrunner == 2.5.5b4',
- 'ManifestDestiny == 0.2.2'],
- classifiers=['Development Status :: 4 - Beta',
- 'Environment :: Console',
- 'Intended Audience :: Developers',
- 'License :: OSI Approved :: Apache Software License',
- 'Operating System :: OS Independent',
- 'Topic :: Software Development :: Libraries :: Python Modules',
- ]
- )
deleted file mode 100644
--- a/mail/test/resources/mozmill/test/commonjs/modules1/moda.js
+++ /dev/null
@@ -1,8 +0,0 @@
-var modb = require("modb"),
- modc = require("../modules2/modc");
-
-exports.add = modc.add;
-
-exports.subtract = function(a, b) {
- return a - b;
-}
\ No newline at end of file
deleted file mode 100644
--- a/mail/test/resources/mozmill/test/commonjs/modules1/modb.js
+++ /dev/null
@@ -1,5 +0,0 @@
-function divide(a, b) {
- return a / b;
-}
-
-exports.divide = divide;
\ No newline at end of file
deleted file mode 100644
--- a/mail/test/resources/mozmill/test/commonjs/modules2/modc.js
+++ /dev/null
@@ -1,3 +0,0 @@
-exports.add = function(a, b) {
- return a + b;
-}
\ No newline at end of file
deleted file mode 100644
--- a/mail/test/resources/mozmill/test/commonjs/tests/test_require.js
+++ /dev/null
@@ -1,4 +0,0 @@
-var moda = require("../modules1/moda");
-
-var six = moda.subtract(10, 4);
-var five = moda.add(2, 3);
\ No newline at end of file
deleted file mode 100644
--- a/mail/test/resources/mozmill/test/dnd/testDragLink.js
+++ /dev/null
@@ -1,18 +0,0 @@
-var setupModule = function(module) {
- module.controller = mozmill.getBrowserController();
-}
-
-var testFoo = function(){
- controller.open('http://www.google.com');
- controller.waitForPageLoad();
-
- var urlbar = new elementslib.Lookup(controller.window.document, '/id("main-window")/id("tab-view-deck")/{"flex":"1"}/id("navigator-toolbox")/id("nav-bar")/id("urlbar-container")/id("urlbar")/anon({"class":"urlbar-frontcap-and-textbox"})/anon({"anonid":"stack"})/anon({"anonid":"textbox-container"})/anon({"anonid":"textbox-input-box"})/anon({"anonid":"input"})');
- var link = new elementslib.Link(controller.tabs.activeTab, "Advanced search");
-
- controller.dragToElement(link, urlbar, 100, 20);
-
- // should visit advanced search page
- controller.waitForPageLoad();
- var advancedSearch = new elementslib.Name(controller.tabs.activeTab, "as_q");
- controller.assertNode(advancedSearch);
-}
deleted file mode 100644
--- a/mail/test/resources/mozmill/test/dnd/testTabView.js
+++ /dev/null
@@ -1,26 +0,0 @@
-var tabview = require("../../../../mozmill-tests/shared-modules/tabview");
-
-var setupModule = function(module) {
- controller = mozmill.getBrowserController();
- tabView = new tabview.tabView(controller);
-}
-
-var testFoo = function() {
- tabView.open();
-
- // wait for tab candy to open
- controller.sleep(2000);
-
- var doc = controller.window.document.getElementById("tab-view").contentDocument;
-
- var tab = new elementslib.Selector(doc, ".tab");
- var content = new elementslib.ID(doc, "content");
- controller.dragToElement(tab, content, 500, 600);
-
- var looseTabs = new elementslib.Selector(doc, ".tabInGroupItem");
- controller.assertNode(looseTabs);
- // there should only be one tab in the group now
- controller.assertJS(function() { return !looseTabs.getNode(1); });
-
- tabView.close();
-}
deleted file mode 100644
--- a/mail/test/resources/mozmill/test/dnd/testhtml.js
+++ /dev/null
@@ -1,16 +0,0 @@
-var setupModule = function(module) {
- controller = mozmill.getBrowserController();
-}
-
-var test = function () {
- controller.open("chrome://mozmill/content/test/test.html");
- controller.waitForPageLoad();
-
- var bar = new elementslib.ID(controller.window.document, "item1");
- var box = new elementslib.ID(controller.window.document, "item2");
-
- controller.dragToElement(bar, box);
-
- // successful drop makes bar disappear
- controller.assertNodeNotExist(bar);
-}
\ No newline at end of file
deleted file mode 100644
--- a/mail/test/resources/mozmill/test/dnd/testxul.js
+++ /dev/null
@@ -1,16 +0,0 @@
-var setupModule = function(module) {
- controller = mozmill.getBrowserController();
-}
-
-var test = function () {
- controller.open("chrome://mozmill/content/test/test.xul");
- controller.waitForPageLoad();
-
- var bar = new elementslib.ID(controller.window.document, "item1");
- var box = new elementslib.ID(controller.window.document, "item2");
-
- controller.dragToElement(bar, box);
-
- // successful drop makes bar disappear
- controller.assertNodeNotExist(bar);
-}
\ No newline at end of file
deleted file mode 100644
--- a/mail/test/resources/mozmill/test/elementLib-UnitTest.js
+++ /dev/null
@@ -1,43 +0,0 @@
-var elementslib = {};
-Components.utils.import('resource://mozmill/modules/elementslib.js', elementslib);
-var mozmill = {};
-Components.utils.import('resource://mozmill/modules/mozmill.js', mozmill);
-
-var test_foo = function(){
- var controller = mozmill.getBrowserController();
- controller.open("http://en-us.www.mozilla.com/en-US/firefox/3.0.1/firstrun/");
-
- // Shorthand
- var content = controller.window.content.document;
- var chrome = controller.window.document;
-
- // Test content XPath detection
- var image = new elementslib.XPath(controller.window.content.document, "/html/body[@id='firstrun']/div[@id='wrapper']/div[@id='doc']/div[@id='main-feature']/h2/img");
- controller.waitForElement(image);
- controller.sleep(1000);
-
- // Test content - ID detection
- e = new elementslib.ID(content, "return");
- controller.click(e);
- controller.sleep(2000);
-
- // Now go back - test chrome button anonymous lookup detection
- e = new elementslib.Lookup(chrome, '/id("main-window")/id("navigator-toolbox")/id("nav-bar")/id("unified-back-forward-button")/id("back-button")/anon({"anonid":"button"})');
- controller.click(e);
- controller.waitForElement(image);
-
- // Test chrome ID detection
- e = new elementslib.ID(chrome, "star-button");
- controller.click(e);
- controller.sleep(1000);
-
- // Test chrome drop down interaction using lookup detection - change searchbox to Yahoo
- e = new elementslib.Lookup(chrome, '/id("main-window")/id("navigator-toolbox")/id("nav-bar")/id("search-container")/id("searchbar")/anon({"anonid":"searchbar-textbox"})/anon({"anonid":"searchbar-engine-button"})/anon({"anonid":"searchbar-popup"})/id("Yahoo")');
- controller.click(e);
- controller.sleep(1000);
-
- // Type in searchbox and hit return
- e = new elementslib.Lookup(chrome, '/id("main-window")/id("navigator-toolbox")/id("nav-bar")/id("search-container")/id("searchbar")/anon({"anonid":"searchbar-textbox"})/anon({"class":"autocomplete-textbox-container"})/anon({"anonid":"textbox-input-box"})/anon({"anonid":"input"})');
- controller.type(e, "mozilla");
- controller.keypress(e, 13);
-}
\ No newline at end of file
deleted file mode 100644
--- a/mail/test/resources/mozmill/test/files/singlediv.html
+++ /dev/null
@@ -1,8 +0,0 @@
-<html>
-<head>
-
-</head>
-<body>
- <div id="test-div"></div>
-</body>
-</html>
\ No newline at end of file
deleted file mode 100644
--- a/mail/test/resources/mozmill/test/first_sunbird_test.js
+++ /dev/null
@@ -1,12 +0,0 @@
-var elementslib = {}; Components.utils.import('resource://mozmill/modules/elementslib.js', elementslib);
-var mozmill = {}; Components.utils.import('resource://mozmill/modules/mozmill.js', mozmill);
-
-var setupModule = function (module) {
- var _w = mozmill.wm.getMostRecentWindow("calendarMainWindow");
- module.calendar = new mozmill.controller.MozMillController(_w);
-}
-
-var test_foo = function(){
- calendar.type(new elementslib.ID(_w.document, 'unifinder-search-field'), "test");
- calendar.sleep(5000);
-}
deleted file mode 100644
--- a/mail/test/resources/mozmill/test/first_thunderbird_test.js
+++ /dev/null
@@ -1,12 +0,0 @@
-var elementslib = {}; Components.utils.import('resource://mozmill/modules/elementslib.js', elementslib);
-var mozmill = {}; Components.utils.import('resource://mozmill/modules/mozmill.js', mozmill);
-
-var setupModule = function(module) {
- var _w = mozmill.wm.getMostRecentWindow("mail:3pane");
- module.messenger = new mozmill.controller.MozMillController(_w);
-}
-
-var test_foo = function(){
- messenger.type(new elementslib.ID(_w.document, 'searchInput'), "test");
- messenger.sleep(5000);
-}
deleted file mode 100644
--- a/mail/test/resources/mozmill/test/restart/test_browser/testPost.js
+++ /dev/null
@@ -1,18 +0,0 @@
-var mozmill = {}; Components.utils.import('resource://mozmill/modules/mozmill.js', mozmill);
-var elementslib = {}; Components.utils.import('resource://mozmill/modules/elementslib.js', elementslib);
-
-var setupModule = function(module) {
- module.controller = mozmill.getBrowserController();
-}
-
-
-var testKnowRightsDoesNotExist = function(){
- if (!persisted.test) {
- throw "Persisted is not working."
- }
- var e = new elementslib.Lookup(controller.window.document, '/id("main-window")/id("browser")/id("appcontent")/id("content")/anon({"anonid":"tabbox"})/anon({"anonid":"panelcontainer"})/[0]/{"value":"about-rights"}/{"accesskey":"K"}');
-
- if (e.exists()) {
- throw 'First run "know our rights" dialog is up after restart';
- }
-}
\ No newline at end of file
deleted file mode 100644
--- a/mail/test/resources/mozmill/test/restart/test_browser/testPre.js
+++ /dev/null
@@ -1,21 +0,0 @@
-var mozmill = {}; Components.utils.import('resource://mozmill/modules/mozmill.js', mozmill);
-var elementslib = {}; Components.utils.import('resource://mozmill/modules/elementslib.js', elementslib);
-
-var setupModule = function(module) {
- module.controller = mozmill.getBrowserController();
-}
-
-persisted.test = true;
-
-var testKnowRightsClick = function(){
- controller.sleep(1000)
- controller.waitForPageLoad(2000)
- controller.sleep(2000)
- var e = new elementslib.Lookup(controller.window.document, '/id("main-window")/id("browser")/id("appcontent")/id("content")/anon({"anonid":"tabbox"})/anon({"anonid":"panelcontainer"})/[0]/{"value":"about-rights"}/{"accesskey":"K"}');
- controller.waitForElement(e);
- controller.click(e);
- controller.sleep(500);
- if (controller.window.document.title != "about:rights") {
- throw "Did not go to the about:rights page."
- }
-}
deleted file mode 100644
--- a/mail/test/resources/mozmill/test/restart/test_fails/testPost.js
+++ /dev/null
@@ -1,58 +0,0 @@
-var jum = {}; Components.utils.import('resource://mozmill/modules/jum.js', jum);
-var mozmill = {}; Components.utils.import('resource://mozmill/modules/mozmill.js', mozmill);
-
-
-var testAsserts = function() {
- jum.assert(true);
- jum.assertTrue(true);
- jum.assertFalse(false);
- jum.assertEquals('asdf', 'asdf');
- jum.assertNotEquals('asdf', 'fdsa');
- jum.assertNull(null);
- jum.assertNotNull(true);
- jum.assertUndefined({}.asdf);
- jum.assertNotUndefined('asdf');
- jum.assertNaN('a');
- jum.assertNotNaN(4);
- jum.pass();
-}
-
-var testAsyncPass = new mozmill.MozMillAsyncTest();
-
-testAsyncPass.testOnePasses = function () {
- jum.assert(true);
- jum.assertTrue(true);
- jum.assertFalse(false);
- jum.assertEquals('asdf', 'asdf');
- jum.assertNotEquals('asdf', 'fdsa');
- jum.assertNull(null);
- jum.assertNotNull(true);
- jum.assertUndefined({}.asdf);
- jum.assertNotUndefined('asdf');
- jum.assertNaN('a');
- jum.assertNotNaN(4);
- jum.pass();
- testAsyncPass.finish();
-}
-
-var testAsyncTimeout = new mozmill.MozMillAsyncTest(1000)
-
-var testNothing = {};
-
-var testNotAsserts = function() {
- // All of these calls should fail
- jum.assert(false);
- jum.assertTrue(false);
- jum.assertTrue('asf');
- jum.assertFalse(true);
- jum.assertFalse('asdf');
- jum.assertEquals('asdf', 'fdsa');
- jum.assertNotEquals('asdf', 'asdf');
- jum.assertNull(true);
- jum.assertNotNull(null);
- jum.assertUndefined('asdf');
- jum.assertNotUndefined({}.asdf);
- jum.assertNaN(4);
- jum.assertNotNaN('f');
- jum.fail();
-}
\ No newline at end of file
deleted file mode 100644
--- a/mail/test/resources/mozmill/test/restart/test_fails/testPre.js
+++ /dev/null
@@ -1,58 +0,0 @@
-var jum = {}; Components.utils.import('resource://mozmill/modules/jum.js', jum);
-var mozmill = {}; Components.utils.import('resource://mozmill/modules/mozmill.js', mozmill);
-
-
-var testAsserts = function() {
- jum.assert(true);
- jum.assertTrue(true);
- jum.assertFalse(false);
- jum.assertEquals('asdf', 'asdf');
- jum.assertNotEquals('asdf', 'fdsa');
- jum.assertNull(null);
- jum.assertNotNull(true);
- jum.assertUndefined({}.asdf);
- jum.assertNotUndefined('asdf');
- jum.assertNaN('a');
- jum.assertNotNaN(4);
- jum.pass();
-}
-
-var testAsyncPass = new mozmill.MozMillAsyncTest();
-
-testAsyncPass.testOnePasses = function () {
- jum.assert(true);
- jum.assertTrue(true);
- jum.assertFalse(false);
- jum.assertEquals('asdf', 'asdf');
- jum.assertNotEquals('asdf', 'fdsa');
- jum.assertNull(null);
- jum.assertNotNull(true);
- jum.assertUndefined({}.asdf);
- jum.assertNotUndefined('asdf');
- jum.assertNaN('a');
- jum.assertNotNaN(4);
- jum.pass();
- testAsyncPass.finish();
-}
-
-var testAsyncTimeout = new mozmill.MozMillAsyncTest(1000)
-
-var testNothing = {};
-
-var testNotAsserts = function() {
- // All of these calls should fail
- jum.assert(false);
- jum.assertTrue(false);
- jum.assertTrue('asf');
- jum.assertFalse(true);
- jum.assertFalse('asdf');
- jum.assertEquals('asdf', 'fdsa');
- jum.assertNotEquals('asdf', 'asdf');
- jum.assertNull(true);
- jum.assertNotNull(null);
- jum.assertUndefined('asdf');
- jum.assertNotUndefined({}.asdf);
- jum.assertNaN(4);
- jum.assertNotNaN('f');
- jum.fail();
-}
\ No newline at end of file
deleted file mode 100644
--- a/mail/test/resources/mozmill/test/restart/test_multi_restart/test1.js
+++ /dev/null
@@ -1,36 +0,0 @@
-var jum = {}; Components.utils.import('resource://mozmill/modules/jum.js', jum);
-var mozmill = {}; Components.utils.import('resource://mozmill/modules/mozmill.js', mozmill);
-
-
-var testAsserts = function() {
- jum.assert(true);
- jum.assertTrue(true);
- jum.assertFalse(false);
- jum.assertEquals('asdf', 'asdf');
- jum.assertNotEquals('asdf', 'fdsa');
- jum.assertNull(null);
- jum.assertNotNull(true);
- jum.assertUndefined({}.asdf);
- jum.assertNotUndefined('asdf');
- jum.assertNaN('a');
- jum.assertNotNaN(4);
- jum.pass();
-}
-
-var testAsyncPass = new mozmill.MozMillAsyncTest();
-
-testAsyncPass.testOnePasses = function () {
- jum.assert(true);
- jum.assertTrue(true);
- jum.assertFalse(false);
- jum.assertEquals('asdf', 'asdf');
- jum.assertNotEquals('asdf', 'fdsa');
- jum.assertNull(null);
- jum.assertNotNull(true);
- jum.assertUndefined({}.asdf);
- jum.assertNotUndefined('asdf');
- jum.assertNaN('a');
- jum.assertNotNaN(4);
- jum.pass();
- testAsyncPass.finish();
-}
deleted file mode 100644
--- a/mail/test/resources/mozmill/test/restart/test_multi_restart/test2.js
+++ /dev/null
@@ -1,37 +0,0 @@
-var jum = {}; Components.utils.import('resource://mozmill/modules/jum.js', jum);
-var mozmill = {}; Components.utils.import('resource://mozmill/modules/mozmill.js', mozmill);
-
-
-var testAsserts = function() {
- jum.assert(true);
- jum.assertTrue(true);
- jum.assertFalse(false);
- jum.assertEquals('asdf', 'asdf');
- jum.assertNotEquals('asdf', 'fdsa');
- jum.assertNull(null);
- jum.assertNotNull(true);
- jum.assertUndefined({}.asdf);
- jum.assertNotUndefined('asdf');
- jum.assertNaN('a');
- jum.assertNotNaN(4);
- jum.pass();
-}
-
-var testAsyncPass = new mozmill.MozMillAsyncTest();
-
-
-testAsyncPass.testOnePasses = function () {
- jum.assert(true);
- jum.assertTrue(true);
- jum.assertFalse(false);
- jum.assertEquals('asdf', 'asdf');
- jum.assertNotEquals('asdf', 'fdsa');
- jum.assertNull(null);
- jum.assertNotNull(true);
- jum.assertUndefined({}.asdf);
- jum.assertNotUndefined('asdf');
- jum.assertNaN('a');
- jum.assertNotNaN(4);
- jum.pass();
- testAsyncPass.finish();
-}
deleted file mode 100644
--- a/mail/test/resources/mozmill/test/restart/test_multi_restart/test3.js
+++ /dev/null
@@ -1,37 +0,0 @@
-var jum = {}; Components.utils.import('resource://mozmill/modules/jum.js', jum);
-var mozmill = {}; Components.utils.import('resource://mozmill/modules/mozmill.js', mozmill);
-
-
-var testAsserts = function() {
- jum.assert(true);
- jum.assertTrue(true);
- jum.assertFalse(false);
- jum.assertEquals('asdf', 'asdf');
- jum.assertNotEquals('asdf', 'fdsa');
- jum.assertNull(null);
- jum.assertNotNull(true);
- jum.assertUndefined({}.asdf);
- jum.assertNotUndefined('asdf');
- jum.assertNaN('a');
- jum.assertNotNaN(4);
- jum.pass();
-}
-
-var testAsyncPass = new mozmill.MozMillAsyncTest();
-
-
-testAsyncPass.testOnePasses = function () {
- jum.assert(true);
- jum.assertTrue(true);
- jum.assertFalse(false);
- jum.assertEquals('asdf', 'asdf');
- jum.assertNotEquals('asdf', 'fdsa');
- jum.assertNull(null);
- jum.assertNotNull(true);
- jum.assertUndefined({}.asdf);
- jum.assertNotUndefined('asdf');
- jum.assertNaN('a');
- jum.assertNotNaN(4);
- jum.pass();
- testAsyncPass.finish();
-}
deleted file mode 100644
--- a/mail/test/resources/mozmill/test/restart/test_multi_restart/test4.js
+++ /dev/null
@@ -1,37 +0,0 @@
-var jum = {}; Components.utils.import('resource://mozmill/modules/jum.js', jum);
-var mozmill = {}; Components.utils.import('resource://mozmill/modules/mozmill.js', mozmill);
-
-
-var testAsserts = function() {
- jum.assert(true);
- jum.assertTrue(true);
- jum.assertFalse(false);
- jum.assertEquals('asdf', 'asdf');
- jum.assertNotEquals('asdf', 'fdsa');
- jum.assertNull(null);
- jum.assertNotNull(true);
- jum.assertUndefined({}.asdf);
- jum.assertNotUndefined('asdf');
- jum.assertNaN('a');
- jum.assertNotNaN(4);
- jum.pass();
-}
-
-var testAsyncPass = new mozmill.MozMillAsyncTest();
-
-
-testAsyncPass.testOnePasses = function () {
- jum.assert(true);
- jum.assertTrue(true);
- jum.assertFalse(false);
- jum.assertEquals('asdf', 'asdf');
- jum.assertNotEquals('asdf', 'fdsa');
- jum.assertNull(null);
- jum.assertNotNull(true);
- jum.assertUndefined({}.asdf);
- jum.assertNotUndefined('asdf');
- jum.assertNaN('a');
- jum.assertNotNaN(4);
- jum.pass();
- testAsyncPass.finish();
-}
deleted file mode 100644
--- a/mail/test/resources/mozmill/test/restart/test_multi_restart/test5.js
+++ /dev/null
@@ -1,37 +0,0 @@
-var jum = {}; Components.utils.import('resource://mozmill/modules/jum.js', jum);
-var mozmill = {}; Components.utils.import('resource://mozmill/modules/mozmill.js', mozmill);
-
-
-var testAsserts = function() {
- jum.assert(true);
- jum.assertTrue(true);
- jum.assertFalse(false);
- jum.assertEquals('asdf', 'asdf');
- jum.assertNotEquals('asdf', 'fdsa');
- jum.assertNull(null);
- jum.assertNotNull(true);
- jum.assertUndefined({}.asdf);
- jum.assertNotUndefined('asdf');
- jum.assertNaN('a');
- jum.assertNotNaN(4);
- jum.pass();
-}
-
-var testAsyncPass = new mozmill.MozMillAsyncTest();
-
-
-testAsyncPass.testOnePasses = function () {
- jum.assert(true);
- jum.assertTrue(true);
- jum.assertFalse(false);
- jum.assertEquals('asdf', 'asdf');
- jum.assertNotEquals('asdf', 'fdsa');
- jum.assertNull(null);
- jum.assertNotNull(true);
- jum.assertUndefined({}.asdf);
- jum.assertNotUndefined('asdf');
- jum.assertNaN('a');
- jum.assertNotNaN(4);
- jum.pass();
- testAsyncPass.finish();
-}
deleted file mode 100644
--- a/mail/test/resources/mozmill/test/restart/test_nothing/testPost.js
+++ /dev/null
@@ -1,36 +0,0 @@
-var jum = {}; Components.utils.import('resource://mozmill/modules/jum.js', jum);
-var mozmill = {}; Components.utils.import('resource://mozmill/modules/mozmill.js', mozmill);
-
-
-var testAsserts = function() {
- jum.assert(true);
- jum.assertTrue(true);
- jum.assertFalse(false);
- jum.assertEquals('asdf', 'asdf');
- jum.assertNotEquals('asdf', 'fdsa');
- jum.assertNull(null);
- jum.assertNotNull(true);
- jum.assertUndefined({}.asdf);
- jum.assertNotUndefined('asdf');
- jum.assertNaN('a');
- jum.assertNotNaN(4);
- jum.pass();
-}
-
-var testAsyncPass = new mozmill.MozMillAsyncTest();
-
-testAsyncPass.testOnePasses = function () {
- jum.assert(true);
- jum.assertTrue(true);
- jum.assertFalse(false);
- jum.assertEquals('asdf', 'asdf');
- jum.assertNotEquals('asdf', 'fdsa');
- jum.assertNull(null);
- jum.assertNotNull(true);
- jum.assertUndefined({}.asdf);
- jum.assertNotUndefined('asdf');
- jum.assertNaN('a');
- jum.assertNotNaN(4);
- jum.pass();
- testAsyncPass.finish();
-}
deleted file mode 100644
--- a/mail/test/resources/mozmill/test/restart/test_nothing/testPre.js
+++ /dev/null
@@ -1,36 +0,0 @@
-var jum = {}; Components.utils.import('resource://mozmill/modules/jum.js', jum);
-var mozmill = {}; Components.utils.import('resource://mozmill/modules/mozmill.js', mozmill);
-
-
-var testAsserts = function() {
- jum.assert(true);
- jum.assertTrue(true);
- jum.assertFalse(false);
- jum.assertEquals('asdf', 'asdf');
- jum.assertNotEquals('asdf', 'fdsa');
- jum.assertNull(null);
- jum.assertNotNull(true);
- jum.assertUndefined({}.asdf);
- jum.assertNotUndefined('asdf');
- jum.assertNaN('a');
- jum.assertNotNaN(4);
- jum.pass();
-}
-
-var testAsyncPass = new mozmill.MozMillAsyncTest();
-
-testAsyncPass.testOnePasses = function () {
- jum.assert(true);
- jum.assertTrue(true);
- jum.assertFalse(false);
- jum.assertEquals('asdf', 'asdf');
- jum.assertNotEquals('asdf', 'fdsa');
- jum.assertNull(null);
- jum.assertNotNull(true);
- jum.assertUndefined({}.asdf);
- jum.assertNotUndefined('asdf');
- jum.assertNaN('a');
- jum.assertNotNaN(4);
- jum.pass();
- testAsyncPass.finish();
-}
deleted file mode 100644
--- a/mail/test/resources/mozmill/test/restart/test_python_callback/callbacks.py
+++ /dev/null
@@ -1,8 +0,0 @@
-def nowCallback(obj):
- assert obj == "pre"
-
-def postCallback(obj):
- assert obj == "post"
-
-def failCallback(obj):
- assert True is False
\ No newline at end of file
deleted file mode 100644
--- a/mail/test/resources/mozmill/test/restart/test_python_callback/testPost.js
+++ /dev/null
@@ -1,6 +0,0 @@
-var jum = {}; Components.utils.import('resource://mozmill/modules/jum.js', jum);
-
-var testPythonCallPost = function() {
- var status = "post";
- mozmill.firePythonCallbackAfterRestart("postCallback", status);
-}
deleted file mode 100644
--- a/mail/test/resources/mozmill/test/restart/test_python_callback/testPre.js
+++ /dev/null
@@ -1,10 +0,0 @@
-var jum = {}; Components.utils.import('resource://mozmill/modules/jum.js', jum);
-
-var testPythonCallNow = function() {
- var state = "pre"
- mozmill.firePythonCallback("nowCallback", state)
-}
-
-var testPythonFail = function() {
- mozmill.firePythonCallback("failCallback", null);
-}
deleted file mode 100644
--- a/mail/test/resources/mozmill/test/restart/test_user_restart/test1.js
+++ /dev/null
@@ -1,12 +0,0 @@
-var setupModule = function(module) {
- module.controller = mozmill.getBrowserController();
-}
-
-/**
- * This test should pass
- */
-var testRestartBeforeTimeout = function() {
- controller.startUserShutdown(2000, true);
- controller.sleep(1000);
- controller.window.Application.restart();
-}
deleted file mode 100644
--- a/mail/test/resources/mozmill/test/restart/test_user_restart/test2.js
+++ /dev/null
@@ -1,11 +0,0 @@
-var setupModule = function(module) {
- module.controller = mozmill.getBrowserController();
-}
-
-/**
- * This test should pass
- */
-var testShutdownBeforeTimeout = function() {
- controller.startUserShutdown(4000, false);
- controller.click(new elementslib.Elem(controller.menus["file-menu"].menu_FileQuitItem));
-}
deleted file mode 100644
--- a/mail/test/resources/mozmill/test/restart/test_user_restart/test3.js
+++ /dev/null
@@ -1,12 +0,0 @@
-var setupModule = function(module) {
- controller = mozmill.getBrowserController();
-}
-
-/**
- * This test should fail
- * (Restart expected but none detected before timeout)
- */
-var testNoExpectedRestartByTimeout = function(){
- controller.startUserShutdown(1000, true);
- controller.sleep(2000);
-}
deleted file mode 100644
--- a/mail/test/resources/mozmill/test/restart/test_user_restart/test4.js
+++ /dev/null
@@ -1,12 +0,0 @@
-var setupModule = function(module) {
- controller = mozmill.getBrowserController();
-}
-
-/**
- * This test should fail
- * (Restart expected but none detected before end of test)
- */
-var testNoExpectedRestartByEndTest = function(){
- controller.startUserShutdown(1000, true);
- controller.sleep(100);
-}
deleted file mode 100644
--- a/mail/test/resources/mozmill/test/restart/test_user_restart/test5.js
+++ /dev/null
@@ -1,12 +0,0 @@
-var setupModule = function(module) {
- controller = mozmill.getBrowserController();
-}
-
-/**
- * This test should fail and then exit with a 'Disconnect Error: Application Unexpectedly Closed'
- */
-var testRestartAfterTimeout = function(){
- controller.startUserShutdown(1000, true);
- controller.sleep(2000);
- controller.window.Application.restart();
-}
deleted file mode 100644
--- a/mail/test/resources/mozmill/test/test_assert.js
+++ /dev/null
@@ -1,24 +0,0 @@
-
-var elementslib = {};
-Components.utils.import('resource://mozmill/modules/elementslib.js', elementslib);
-var mozmill = {};
-Components.utils.import('resource://mozmill/modules/mozmill.js', mozmill);
-
-var test_assert = function(){
- var controller = mozmill.getBrowserController();
- controller.open('http://www.google.com');
- controller.sleep(2000);
- controller.type(new elementslib.Name(controller.window.content.document, 'q'), 'Mozilla');
- controller.assertValue(new elementslib.Name(controller.window.content.document, 'q'), 'Mozilla');
- controller.keypress(new elementslib.Name(controller.window.content.document, 'btnG'), 13);
- controller.sleep(2000);
- controller.type(new elementslib.Name(controller.window.content.document, 'q'), 'Mozilla Summit');
- controller.click(new elementslib.Name(controller.window.content.document, 'btnG'));
- controller.sleep(2000);
-
- // chrome
- controller.assertNode(new elementslib.ID(controller.window.document, 'searchbar'));
- controller.type(new elementslib.ID(controller.window.document, 'searchbar'), 'Mozilla Summit');
- controller.assertValue(new elementslib.ID(controller.window.document, 'searchbar'), 'Mozilla Summit');
- controller.keypress(new elementslib.ID(controller.window.document, 'searchbar'), '13');
-}
\ No newline at end of file
deleted file mode 100644
--- a/mail/test/resources/mozmill/test/test_demo.js
+++ /dev/null
@@ -1,71 +0,0 @@
-var elementslib = {}; Components.utils.import('resource://mozmill/modules/elementslib.js', elementslib);
-var mozmill = {}; Components.utils.import('resource://mozmill/modules/mozmill.js', mozmill);
-var controller = {}; Components.utils.import('resource://mozmill/modules/controller.js', controller);
-
-var test_PrefsContentTab = function() {
- // Bring up preferences controller.
- var controller = new controller.MozMillController(mozmill.utils.getWindowByType("Browser:Preferences"));
-
- // click on the Content prefs tab
- controller.click(new elementslib.Elem( controller.tabs.Content.button ));
- controller.sleep(1000);
- // sleep for a second
- e = new elementslib.ID(controller.window.document, 'popupPolicy')
- controller.waitForElement(e);
- // disable "Block popups"
- controller.click(e);
- controller.sleep(1000);
- // disable "Load Images"
- controller.click(new elementslib.ID(controller.window.document, 'loadImages'));
- controller.sleep(1000);
- // disable JavaScript
- controller.click(new elementslib.ID(controller.window.document, 'enableJavaScript'));
- controller.sleep(1000);
- // disable Java
- controller.click(new elementslib.ID(controller.window.document, 'enableJava'));
- controller.sleep(1000);
-}
-
-var test_GoogleDotCom = function () {
- // Bring up browser controller.
- var controller = mozmill.getBrowserController();
- controller.window.focus();
- controller.open('http://www.google.com');
- controller.sleep(2000);
- controller.type(new elementslib.Name(controller.window.content.document, 'q'), 'Mozilla');
- controller.assertValue(new elementslib.Name(controller.window.content.document, 'q'), 'Mozilla');
- controller.sleep(2000);
- controller.click(new elementslib.Name(controller.window.content.document, 'btnG'));
- controller.sleep(2000);
-}
-
-var test_mozillaorg = function () {
- // Bring up browser controller.
- var controller = mozmill.getBrowserController();
- controller.window.focus();
- controller.open('http://www.mozilla.org');
- controller.sleep(5000);
- controller.type(new elementslib.Name(controller.window.content.document, 'q'), 'QA');
- controller.waitForElement(new elementslib.Name(controller.window.content.document, 'q'));
- controller.click(new elementslib.ID(controller.window.content.document, 'submit'));
- controller.sleep(3000);
- controller.click(new elementslib.Link(controller.window.content.document, 'Mozilla'));
- controller.sleep(2000);
- controller.waitForElement(new elementslib.Link(controller.window.content.document, 'Tools'));
- controller.click(new elementslib.Link(controller.window.content.document, 'Tools'));
- controller.waitForElement(new elementslib.ID(controller.window.content.document, 'searchInput'));
- controller.type(new elementslib.ID(controller.window.content.document, 'searchInput'), 'MozMill');
- controller.sleep(1000);
- controller.click(new elementslib.Name(controller.window.content.document, 'fulltext'));
- controller.sleep(3000);
- controller.open('http://code.google.com/p/mozmill/');
- controller.sleep(3000);
- controller.waitForElement(new elementslib.Link(controller.window.content.document, 'Downloads'));
- controller.click(new elementslib.Link(controller.window.content.document, 'Downloads'));
- controller.sleep(3000);
- controller.click(new elementslib.Link(controller.window.content.document, 'Source'));
- controller.sleep(3000);
- controller.open('http://www.mozilla.org');
-}
-
-test_mozillaorg.EXCLUDED_PLATFORMS = ['darwin'];
deleted file mode 100644
--- a/mail/test/resources/mozmill/test/test_diggIterator.js
+++ /dev/null
@@ -1,18 +0,0 @@
-var elementslib = {}; Components.utils.import('resource://mozmill/modules/elementslib.js', elementslib);
-var mozmill = {}; Components.utils.import('resource://mozmill/modules/mozmill.js', mozmill);
-
-// var test_DiggIterator = function () {
-// // Bring up browser controller.
-// var controller = mozmill.getBrowserController();
-// controller.open('http://www.digg.com');
-// controller.waitForElement(new elementslib.Elem( controller.window.content.document.body ));
-// controller.sleep(5000);
-// var links = controller.window.content.document.getElementsByTagName('a');
-//
-// for (var i = 0; i<links.length; i++){
-// controller.click(new elementslib.Elem( links[i] ));
-// controller.sleep(3000);
-// links = controller.window.content.document.getElementsByTagName('a');
-// controller.sleep(2000);
-// }
-// }
\ No newline at end of file
deleted file mode 100644
--- a/mail/test/resources/mozmill/test/test_focus.js
+++ /dev/null
@@ -1,101 +0,0 @@
-/* * ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is MozMill Test code.
- *
- * The Initial Developer of the Original Code is Mozilla Corporation.
- * Portions created by the Initial Developer are Copyright (C) 2009
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- * Henrik Skupin <hskupin@mozilla.com>
-*
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * **** END LICENSE BLOCK ***** */
-
-var gDelay = 500;
-
-var setupModule = function(module) {
- controller = mozmill.getBrowserController();
-}
-
-var checkKeypressFunction = function(element) {
- element.getNode().value = "";
-
- // controller.keypress should not focus element when window is given as element
- controller.keypress(null, "F", {});
- controller.sleep(gDelay);
- controller.assertValue(element, "");
-
- // controller.keypress should focus the element when the element itself is given as parameter
- controller.keypress(element, "M", {});
- controller.sleep(gDelay);
- controller.assertValue(element, "M");
-
- // controller.keypress should not clear formerly entered text
- controller.keypress(element, "F", {});
- controller.sleep(gDelay);
- controller.assertValue(element, "MF");
-}
-
-var checkTypeFunction = function(element) {
- element.getNode().value = "";
-
- // controller.type should not focus element when window is given as element
- controller.type(null, "Firefox");
- controller.sleep(gDelay);
- controller.assertValue(element, "");
-
- // controller.type should focus the element when the element itself is given as parameter
- controller.type(element, "Mozilla");
- controller.sleep(gDelay);
- controller.assertValue(element, "Mozilla");
-
- // controller.type should not clear formerly entered text
- controller.type(element, " Firefox");
- controller.sleep(gDelay);
- controller.assertValue(element, "Mozilla Firefox");
-}
-
-var testContentTextboxFocus = function() {
- controller.open("http://www.mozilla.org");
- controller.waitForPageLoad(controller.tabs.activeTab);
-
- var searchField = new elementslib.ID(controller.tabs.activeTab, "q");
- controller.waitForElement(searchField, 5000);
- controller.sleep(gDelay);
-
- checkKeypressFunction(searchField);
- checkTypeFunction(searchField);
-}
-
-var testChromeTextboxFocus = function() {
- var searchBar = new elementslib.ID(controller.window.document, "searchbar");
-
- checkKeypressFunction(searchBar);
-
- // Move focus to the location bar to blur the search bar
- controller.keypress(null, "l", {accelKey: true});
- checkTypeFunction(searchBar);
-}
\ No newline at end of file
deleted file mode 100644
--- a/mail/test/resources/mozmill/test/test_git.js
+++ /dev/null
@@ -1,5 +0,0 @@
-this is a dummy test file so I can learn some git
-checking up on the workflow to make sure the wiki is right
-and one more because there is this debate on historical branch only commits.
-It's a sad day when I'm the one having to do this to settle the score.
-
deleted file mode 100644
--- a/mail/test/resources/mozmill/test/test_googleIterator.js
+++ /dev/null
@@ -1,21 +0,0 @@
-var elementslib = {}; Components.utils.import('resource://mozmill/modules/elementslib.js', elementslib);
-var mozmill = {}; Components.utils.import('resource://mozmill/modules/mozmill.js', mozmill);
-
-// var test_GoogleIterator = function () {
-// // Bring up browser controller.
-// var controller = mozmill.getBrowserController();
-// controller.open('http://www.google.com');
-// controller.waitForElement(new elementslib.Elem( controller.window.content.document.body ));
-// controller.sleep(5000);
-// controller.type(new elementslib.Name(controller.window.content.document, 'q'), 'Mozilla');
-// controller.click(new elementslib.Name(controller.window.content.document, 'btnG'));
-// controller.sleep(2000);
-// var links = controller.window.content.document.getElementsByTagName('a');
-//
-// for (var i = 0; i<links.length; i++){
-// controller.click(new elementslib.Elem( links[i] ));
-// controller.sleep(5000);
-// links = controller.window.content.document.getElementsByTagName('a');
-// controller.sleep(2000);
-// }
-// }
\ No newline at end of file
deleted file mode 100644
--- a/mail/test/resources/mozmill/test/test_jum.js
+++ /dev/null
@@ -1,31 +0,0 @@
-var jum = {}; Components.utils.import('resource://mozmill/modules/jum.js', jum);
-
-var testFails = function() {
- jum.assert(false, "failed");
- jum.assertTrue(false, "failed");
- jum.assertFalse(true, "failed");
- jum.assertEquals(2, 3, "failed");
- jum.assertNotEquals(3, 3, "failed");
- jum.assertNull(true, "failed");
- jum.assertNotNull(null, "failed");
- jum.assertUndefined(true, "failed");
- jum.assertNotUndefined(undefined, "failed");
- jum.assertNaN(3, "failed");
- jum.assertNotNaN(NaN, "failed");
- jum.fail("failed");
-}
-
-var testPass = function() {
- jum.assert(true, "shouldn't fail");
- jum.assertTrue(true, "shouldn't fail");
- jum.assertFalse(false, "shouldn't fail");
- jum.assertEquals(3, 3, "shouldn't fail");
- jum.assertNotEquals(2, 3, "shouldn't fail");
- jum.assertNull(null, "shouldn't fail");
- jum.assertNotNull(true, "shouldn't fail");
- jum.assertUndefined(undefined, "shouldn't fail");
- jum.assertNotUndefined(true, "shouldn't fail");
- jum.assertNaN(NaN, "shouldn't fail");
- jum.assertNotNaN(true, "shouldn't fail");
- jum.pass("shouldn't fail");
-}
\ No newline at end of file
deleted file mode 100644
--- a/mail/test/resources/mozmill/test/test_menu.js
+++ /dev/null
@@ -1,36 +0,0 @@
-var setupTest = function() {
- controller = mozmill.getBrowserController();
-
- // Create a new menu instance for the context menu
- contextMenu = controller.getMenu("#contentAreaContextMenu");
-}
-
-var testMenuAPI = function() {
- // Open a new tab by using the main menu
- controller.mainMenu.click("#menu_newNavigatorTab");
-
- controller.open("http://www.mozilla.org");
- controller.waitForPageLoad();
-
- // Enter text in a text field and select all via the context menu
- var search = new elementslib.ID(controller.tabs.activeTab, "q");
- controller.type(search, "mozmill");
- contextMenu.select("#context-selectall", search);
-
- // Reopen the context menu and check the 'Paste' menu item
- contextMenu.open(search);
- var state = contextMenu.getItem("#context-viewimage");
- controller.assert(function() {
- return state.getNode().hidden;
- }, "Context menu entry 'View Image' is not visible");
-
- // Remove the text by selecting 'Undo'
- contextMenu.keypress("VK_DOWN", {});
- contextMenu.keypress("VK_ENTER", {});
- contextMenu.close();
-
- controller.assert(function() {
- return search.getNode().value == "";
- }, "Text field has been emptied.");
-}
-
deleted file mode 100644
--- a/mail/test/resources/mozmill/test/test_prefs.js
+++ /dev/null
@@ -1,74 +0,0 @@
-var elementslib = {}; Components.utils.import('resource://mozmill/modules/elementslib.js', elementslib);
-var mozmill = {}; Components.utils.import('resource://mozmill/modules/mozmill.js', mozmill);
-var controller = {}; Components.utils.import('resource://mozmill/modules/controller.js', controller);
-
-var setupModule = function(module) {
- module.controller = new controller.MozMillController(mozmill.utils.getWindowByType("Browser:Preferences"));
-}
-
-var test_TabsTab = function() {
- // Click on Tab tab
- controller.click(new elementslib.Elem( controller.tabs.Tabs.button ));
- // Warn on close
- var warnElem = new elementslib.ID(controller.window.document, 'warnCloseMultiple');
- controller.waitForElement(warnElem);
- controller.click(warnElem);
- // Warn on opening many windows
- controller.click(new elementslib.ID(controller.window.document, 'warnOpenMany'));
- // Show the tab bar
- controller.click(new elementslib.ID(controller.window.document, 'showTabBar'));
- // Switch to new Tabs
- controller.click(new elementslib.ID(controller.window.document, 'switchToNewTabs'));
- controller.sleep(1000);
-}
-
-var test_ContentTab = function() {
- // Click on the proper Tab Button
- controller.click(new elementslib.Elem( controller.tabs.Content.button ));
- controller.sleep(1000);
-
- // disable "Block popups"
- controller.click(new elementslib.ID(controller.window.document, 'popupPolicy'));
- // disable "Load Images"
- controller.click(new elementslib.ID(controller.window.document, 'loadImages'));
- // disable JavaScript
- controller.click(new elementslib.ID(controller.window.document, 'enableJavaScript'));
- // disable Java
- controller.click(new elementslib.ID(controller.window.document, 'enableJava'));
-
- // Set Default Font
- // controller.click(new elementslib.ID(controller.window.document, 'defaultFont'))
- // controller.click(new elementslib.XPATH(controller.window.document, '/prefwindow[@id='BrowserPreferences']/prefpane[@id='paneContent']/xul:vbox'))
-
-}
-
-var test_ApplicationsTab = function() {
- e = new elementslib.Elem( controller.tabs.Applications.button );
- controller.click(e);
- controller.sleep(500);
-
- // // Click on the search box
- // var node = controller.window.document.getAnonymousElementByAttribute(
- // controller.window.document.getElementById('paneApplications').getElementsByTagName(
- // 'hbox')[0].getElementsByTagName('textbox')[0],
- // 'class',
- // 'textbox-input-box');
- //
- // e = new elementslib.Elem(node.childNodes[0]);
- //
- // controller.click(new elementslib.Elem(node.childNodes[0]));
- // controller.sleep(1000);
-
-}
-
-var test_PrivacyTab = function() {
- controller.click(new elementslib.Elem( controller.tabs.Privacy.button ));
- controller.sleep(500);
- controller.click(new elementslib.ID(controller.window.document, 'rememberHistoryDays'));
- controller.click(new elementslib.ID(controller.window.document, 'rememberForms'));
- controller.click(new elementslib.ID(controller.window.document, 'rememberDownloads'));
- controller.click(new elementslib.ID(controller.window.document, 'acceptThirdParty'));
- controller.click(new elementslib.ID(controller.window.document, 'acceptCookies'));
- controller.click(new elementslib.ID(controller.window.document, 'alwaysClear'));
- controller.click(new elementslib.ID(controller.window.document, 'askBeforeClear'));
-}
deleted file mode 100644
--- a/mail/test/resources/mozmill/test/test_property.js
+++ /dev/null
@@ -1,72 +0,0 @@
-/* * ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is MozMill Test code.
- *
- * The Initial Developer of the Original Code is Fidesfit.
- * Portions created by the Initial Developer are Copyright (C) 2010
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- * M.-A. Darche (Original Author)
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * **** END LICENSE BLOCK ***** */
-
-Components.utils.import('resource://mozmill/modules/jum.js');
-
-var setupModule = function(module) {
- controller = mozmill.getBrowserController();
-};
-
-var testProperty = function() {
- var res;
-
- var menu_item = new elementslib.ID(controller.window.document, 'file-menu');
- controller.click(menu_item);
-
- var new_tab_menu_item = new elementslib.ID(controller.window.document,
- 'menu_newNavigatorTab');
- res = controller.assertProperty(new_tab_menu_item, 'command', 'cmd_newNavigatorTab');
- assertEquals(true, res);
-
- res = controller.assertProperty(new_tab_menu_item, 'command', '');
- assertEquals(false, res);
-};
-
-var testPropertyNotEquals = function() {
- var res;
-
- var menu_item = new elementslib.ID(controller.window.document, 'file-menu');
- controller.click(menu_item);
-
- var new_tab_menu_item = new elementslib.ID(controller.window.document,
- 'menu_newNavigatorTab');
- res = controller.assertPropertyNotEquals(new_tab_menu_item, 'command', 'cmd_newNavigatorTab');
- assertEquals(false, res);
-
- res = controller.assertPropertyNotEquals(new_tab_menu_item, 'command', '');
- assertEquals(true, res);
-};
-
deleted file mode 100644
--- a/mail/test/resources/mozmill/test/test_python_callbacks.js
+++ /dev/null
@@ -1,10 +0,0 @@
-var jum = {}; Components.utils.import('resource://mozmill/modules/jum.js', jum);
-
-var testPythonCallback = function() {
- var state = "test"
- mozmill.firePythonCallback("nowCallback", state)
-}
-
-var testPythonFail = function() {
- mozmill.firePythonCallback("failCallback", null);
-}
deleted file mode 100644
--- a/mail/test/resources/mozmill/test/test_python_callbacks_callbacks.py
+++ /dev/null
@@ -1,5 +0,0 @@
-def nowCallback(obj):
- assert obj == "test"
-
-def failCallback(obj):
- assert True is False
deleted file mode 100644
--- a/mail/test/resources/mozmill/test/test_radio.js
+++ /dev/null
@@ -1,33 +0,0 @@
-// Set to your local copy of shared-modules
-var prefs = require("../../mozmill-tests/shared-modules/prefs");
-
-var setupModule = function(module) {
- module.controller = mozmill.getBrowserController();
-}
-
-var testHTMLRadio = function() {
- controller.open('http://www.google.com/cse?cx=002443141534113389537%3Aysdmevkkknw&cof=FORID%3A0&q=mozmill&x=0&y=0');
- controller.waitForPageLoad();
-
- var radio = new elementslib.ID(controller.tabs.activeTab, "www");
- controller.radio(radio);
- controller.sleep(2000);
-}
-
-var testXULRadio = function() {
- prefs.openPreferencesDialog(controller, prefDialogCallback);
-}
-
-var prefDialogCallback = function(controller) {
- var prefDialog = new prefs.preferencesDialog(controller);
-
- var radio = new elementslib.ID(controller.window.document, "alwaysAsk");
- controller.radio(radio);
- controller.sleep(2000);
-
- radio = new elementslib.ID(controller.window.document, "saveTo");
- controller.radio(radio);
- controller.sleep(2000);
-
- prefDialog.close(true);
-}
deleted file mode 100644
--- a/mail/test/resources/mozmill/test/test_reportErrorConsole.js
+++ /dev/null
@@ -1,10 +0,0 @@
-var setupModule = function() {
- controller = mozmill.getBrowserController();
-}
-
-var testErrorConsole = function() {
- controller.open("http://www.mozilla.org");
- controller.waitForPageLoad();
-
- var syntaxError =
-}
deleted file mode 100644
--- a/mail/test/resources/mozmill/test/test_selector.js
+++ /dev/null
@@ -1,15 +0,0 @@
-var setupTest = function() {
- controller = mozmill.getBrowserController();
-}
-
-var testSelector = function() {
- controller.open('www.google.com');
- controller.waitForPageLoad();
-
- var elem = new elementslib.ID(controller.tabs.activeTab, "q");
- var elemBySelector = new elementslib.Selector(controller.tabs.activeTab, "#q");
-
- controller.assert(function() { return elem.getNode() == elemBySelector.getNode() });
- controller.assert(function() { return elem.getNode() == elemBySelector.getNode(0) });
-}
-
deleted file mode 100644
--- a/mail/test/resources/mozmill/test/test_something/test_parents.js
+++ /dev/null
@@ -1,12 +0,0 @@
-
-var MODULE_NAME = 'test_parent';
-
-var asdf = 'asdf'
-
-var setupModule = function (module) {
-
-}
-
-var testInParent = function () {
-
-}
\ No newline at end of file
deleted file mode 100644
--- a/mail/test/resources/mozmill/test/test_something/test_sub/test_deps.js
+++ /dev/null
@@ -1,13 +0,0 @@
-var jum = {}; Components.utils.import('resource://mozmill/modules/jum.js', jum);
-
-var RELATIVE_ROOT = '..';
-
-var MODULE_REQUIRES = ['test_parent'];
-
-var setupModule = function(module) {
- // module.asdf = module.collector.getModule('test_parent').asdf;
-}
-
-var testDependencies = function() {
- jum.assertEquals(test_parent.asdf, 'asdf');
-}
\ No newline at end of file
deleted file mode 100644
--- a/mail/test/resources/mozmill/test/test_staleelement.js
+++ /dev/null
@@ -1,20 +0,0 @@
-const localTestFolder = collector.addHttpResource('./files/');
-
-var setupTest = function() {
- controller = mozmill.getBrowserController();
-}
-
-var testReload = function() {
- var testPage = localTestFolder + "singlediv.html";
- controller.open(testPage);
- controller.waitForPageLoad();
-
- var elem = new elementslib.Selector(controller.tabs.activeTab, "#test-div");
- controller.assertNode(elem);
-
- controller.open(testPage);
- controller.waitForPageLoad();
-
- controller.assertNode(elem);
-}
-
deleted file mode 100644
--- a/mail/test/resources/mozmill/test/test_synthesizeEvents.js
+++ /dev/null
@@ -1,50 +0,0 @@
-var setupTest = function() {
- controller = mozmill.getBrowserController();
-}
-
-var testExpectedEvent = function() {
- controller.open("http://www.mozilla.com/en-US/");
- controller.waitForPageLoad();
-
- var search = new elementslib.ID(controller.tabs.activeTab, "query");
- var submit = new elementslib.ID(controller.tabs.activeTab, "submit");
-
- // Clicking the search field should raise a focus event
- controller.click(search, 2, 2, {type: "focus"});
-
- // Synthesize a keypress without and with an expected event
- controller.keypress(search, "F", {});
- controller.keypress(search, "i", {}, {type: "keypress"});
-
- // Synthesize a keypress without and with an expected event
- controller.type(search, "ref");
- controller.type(search, "ox", {type: "keypress"});
-
- // Using Cmd/Ctrl+A should fire a select event on that element
- controller.keypress(search, "a", {accelKey: true}, {type: "keypress"});
-
- // A focus event for the next element in the tab order should be fired
- controller.keypress(null, "VK_TAB", {}, {type: "focus", target: submit});
-
- // Opening the context menu shouldn't raise a click event
- try {
- controller.rightClick(submit, 2, 2, {type: "click", target: submit});
- throw new Error("Opening a context menu has raised a click event.");
- } catch (ex) {
- }
-
- // ... but a contextmenu event
- controller.rightClick(submit, 2, 2, {type: "contextmenu", target: submit});
-
- // With no event type specified we should throw an error
- var catched = true;
- try {
- controller.keypress(null, "VK_TAB", {}, {target: submit});
- catched = false;
- } catch (ex) {}
-
- if (!catched) {
- throw new Error("Missing event type should cause a failure.")
- }
-}
-
deleted file mode 100644
--- a/mail/test/resources/mozmill/test/test_unit.js
+++ /dev/null
@@ -1,59 +0,0 @@
-var jum = {}; Components.utils.import('resource://mozmill/modules/jum.js', jum);
-var mozmill = {}; Components.utils.import('resource://mozmill/modules/mozmill.js', mozmill);
-
-
-var testAsserts = function() {
- jum.assert(true);
- jum.assertTrue(true);
- jum.assertFalse(false);
- jum.assertEquals('asdf', 'asdf');
- jum.assertNotEquals('asdf', 'fdsa');
- jum.assertNull(null);
- jum.assertNotNull(true);
- jum.assertUndefined({}.asdf);
- jum.assertNotUndefined('asdf');
- jum.assertNaN('a');
- jum.assertNotNaN(4);
- jum.pass();
-}
-testAsserts.meta = {'litmusids':[2345678]}
-
-var testAsyncPass = new mozmill.MozMillAsyncTest();
-
-testAsyncPass.testOnePasses = function () {
- jum.assert(true);
- jum.assertTrue(true);
- jum.assertFalse(false);
- jum.assertEquals('asdf', 'asdf');
- jum.assertNotEquals('asdf', 'fdsa');
- jum.assertNull(null);
- jum.assertNotNull(true);
- jum.assertUndefined({}.asdf);
- jum.assertNotUndefined('asdf');
- jum.assertNaN('a');
- jum.assertNotNaN(4);
- jum.pass();
- testAsyncPass.finish();
-}
-
-var testAsyncTimeout = new mozmill.MozMillAsyncTest(1000)
-
-var testNothing = {};
-
-var testNotAsserts = function() {
- // All of these calls should fail
- jum.assert(false);
- jum.assertTrue(false);
- jum.assertTrue('asf');
- jum.assertFalse(true);
- jum.assertFalse('asdf');
- jum.assertEquals('asdf', 'fdsa');
- jum.assertNotEquals('asdf', 'asdf');
- jum.assertNull(true);
- jum.assertNotNull(null);
- jum.assertUndefined('asdf');
- jum.assertNotUndefined({}.asdf);
- jum.assertNaN(4);
- jum.assertNotNaN('f');
- jum.fail();
-}
\ No newline at end of file
deleted file mode 100644
--- a/mail/test/resources/mozmill/test/test_usershutdown.js
+++ /dev/null
@@ -1,11 +0,0 @@
-var setupModule = function(module) {
- module.controller = mozmill.getBrowserController();
-}
-
-/**
- * This test should pass
- */
-var testRestartBeforeTimeout = function() {
- controller.startUserShutdown(4000, false);
- controller.click(new elementslib.Elem(controller.menus["file-menu"].menu_FileQuitItem));
-}
deleted file mode 100644
--- a/mail/test/resources/mozmill/test/test_waitForPageLoad.js
+++ /dev/null
@@ -1,145 +0,0 @@
-const LOCATIONS = [
- // Normal pages
- {url : "http://www.google.de", type: "id", value : "logo"},
- {url : "https://addons.mozilla.org/en-US/firefox/?browse=featured", type: "id", value : "search-q"},
- {url : "http://addons.mozilla.org", type: "id", value : "search-q"},
-
- // FTP pages
- {url : "ftp://ftp.mozilla.org/pub/", type : "link", value : "firefox" },
-
- // Error pages
- {url : "https://mur.at", type: "id", value : "cert_domain_link"},
- {url : "http://www.mozilla.com/firefox/its-a-trap.html", type: "id", value : "ignoreWarningButton"},
- {url : "https://mozilla.org/", type: "id", value : "getMeOutOfHereButton"},
- {url : "http://people.mozilla.org/~ctalbert/testpages/iframetest.html", type: "id", value: "iframe"}
-];
-
-
-var setupTest = function() {
- controller = mozmill.getBrowserController();
-}
-
-var testWaitForPageLoad = function() {
-
- /**
- * PART I - Check different types of pages
- */
- for each (var location in LOCATIONS) {
- controller.open(location.url);
- controller.waitForPageLoad();
-
- // Check that the expected element exists
- if (location.type) {
- var elem = null;
-
- switch (location.type) {
- case "link":
- elem = new elementslib.Link(controller.tabs.activeTab, location.value);
- break;
- case "name":
- elem = new elementslib.Name(controller.tabs.activeTab, location.value);
- break;
- case "id":
- elem = new elementslib.ID(controller.tabs.activeTab, location.value);
- break;
- default:
- }
-
- controller.assertNode(elem);
- }
- }
-
- /**
- * PART II - Test different parameter sets
- */
- var location = LOCATIONS[0];
- for (var i = 0; i < 7; i++) {
- controller.open(location.url);
-
- switch (i) {
- case 0:
- controller.waitForPageLoad(controller.tabs.activeTab);
- break;
- case 1:
- controller.waitForPageLoad(controller.tabs.activeTab, undefined, 10);
- break;
- case 2:
- controller.waitForPageLoad(controller.tabs.activeTab, "invalid");
- break;
- case 3:
- controller.waitForPageLoad(undefined, null, 100);
- break;
- case 4:
- controller.waitForPageLoad(null, undefined, 100);
- break;
- case 5:
- controller.waitForPageLoad("invalid", undefined);
- break;
- case 6:
- controller.waitForPageLoad(undefined, "invalid");
- break;
- }
- }
-
- /**
- * PART III - Check that we correctly handle timeouts for waitForPageLoad
- */
- try {
- controller.open(LOCATIONS[0].url);
- controller.waitForPageLoad(0);
-
- throw new Error("controller.waitForPageLoad() not timed out for timeout=0.");
- } catch (ex) {}
-
- /**
- * PART IV - Make sure we don't fail when clicking links on a page
- */
- controller.open("http://www.mozilla.org");
- controller.waitForPageLoad();
-
- var link = new elementslib.Link(controller.tabs.activeTab, "Get Involved");
- controller.click(link);
- controller.waitForPageLoad();
-
- var target = new elementslib.Name(controller.tabs.activeTab, "area");
- controller.waitForElement(target, 1000);
-
- /**
- * PART V - When waitForPageLoad is called when the page has already been loaded
- * we shouldn't fail
- */
- controller.open(LOCATIONS[0].url);
- controller.waitForPageLoad();
- controller.waitForPageLoad(500);
-
-
- /**
- * PART VI - Loading a page in another tab should wait for its completion
- */
- controller.open(LOCATIONS[1].url);
-
- controller.keypress(null, "t", {accelKey: true});
- controller.open(LOCATIONS[0].url);
-
- var firstTab = controller.tabs.getTab(0);
- var element = new elementslib.ID(firstTab, LOCATIONS[1].value);
- controller.waitForPageLoad(firstTab);
- controller.assertNode(element);
-
- /**
- * PART VII - Loading an embedded web page (discovery pane)
- */
- controller.open("about:addons");
- controller.waitForPageLoad();
-
- var browser = new elementslib.ID(controller.tabs.activeTab, "discover-browser");
- var doc = browser.getNode().contentDocument;
-
- // Before the real discovery pane gets loaded a blank page is shown
- controller.waitForPageLoad(doc, 1000);
- controller.assert(function () {
- return doc.location.href === "about:blank";
- }, "Initial page has been loaded, got '" + doc.location +
- "' - expected 'about:blank'.");
-}
-
deleted file mode 100644
--- a/mail/test/resources/mozrunner/mozrunner/__init__.py
+++ /dev/null
@@ -1,660 +0,0 @@
-# ***** BEGIN LICENSE BLOCK *****
-# Version: MPL 1.1/GPL 2.0/LGPL 2.1
-#
-# The contents of this file are subject to the Mozilla Public License Version
-# 1.1 (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-# http://www.mozilla.org/MPL/
-#
-# Software distributed under the License is distributed on an "AS IS" basis,
-# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-# for the specific language governing rights and limitations under the
-# License.
-#
-# The Original Code is Mozilla Corporation Code.
-#
-# The Initial Developer of the Original Code is
-# Mikeal Rogers.
-# Portions created by the Initial Developer are Copyright (C) 2008-2009
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-# Mikeal Rogers <mikeal.rogers@gmail.com>
-# Clint Talbert <ctalbert@mozilla.com>
-# Henrik Skupin <hskupin@mozilla.com>
-#
-# Alternatively, the contents of this file may be used under the terms of
-# either the GNU General Public License Version 2 or later (the "GPL"), or
-# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-# in which case the provisions of the GPL or the LGPL are applicable instead
-# of those above. If you wish to allow use of your version of this file only
-# under the terms of either the GPL or the LGPL, and not to allow others to
-# use your version of this file under the terms of the MPL, indicate your
-# decision by deleting the provisions above and replace them with the notice
-# and other provisions required by the GPL or the LGPL. If you do not delete
-# the provisions above, a recipient may use your version of this file under
-# the terms of any one of the MPL, the GPL or the LGPL.
-#
-# ***** END LICENSE BLOCK *****
-
-import os
-import sys
-import copy
-import tempfile
-import commands
-import zipfile
-import optparse
-import killableprocess
-import subprocess
-import platform
-import shutil
-
-from distutils import dir_util
-from time import sleep
-from xml.dom import minidom
-
-# conditional (version-dependent) imports
-try:
- import simplejson
-except ImportError:
- import json as simplejson
-
-import logging
-logger = logging.getLogger(__name__)
-
-# Use dir_util for copy/rm operations because shutil is all kinds of broken
-copytree = dir_util.copy_tree
-rmtree = dir_util.remove_tree
-
-def findInPath(fileName, path=os.environ['PATH']):
- dirs = path.split(os.pathsep)
- for dir in dirs:
- if os.path.isfile(os.path.join(dir, fileName)):
- return os.path.join(dir, fileName)
- if os.name == 'nt' or sys.platform == 'cygwin':
- if os.path.isfile(os.path.join(dir, fileName + ".exe")):
- return os.path.join(dir, fileName + ".exe")
- return None
-
-stdout = sys.stdout
-stderr = sys.stderr
-stdin = sys.stdin
-
-def run_command(cmd, env=None, **kwargs):
- """Run the given command in killable process."""
- killable_kwargs = {'stdout':stdout ,'stderr':stderr, 'stdin':stdin}
- killable_kwargs.update(kwargs)
-
- if sys.platform != "win32":
- return killableprocess.Popen(cmd, preexec_fn=lambda : os.setpgid(0, 0),
- env=env, **killable_kwargs)
- else:
- return killableprocess.Popen(cmd, env=env, **killable_kwargs)
-
-def getoutput(l):
- tmp = tempfile.mktemp()
- x = open(tmp, 'w')
- subprocess.call(l, stdout=x, stderr=x)
- x.close(); x = open(tmp, 'r')
- r = x.read() ; x.close()
- os.remove(tmp)
- return r
-
-def get_pids(name, minimun_pid=0):
- """Get all the pids matching name, exclude any pids below minimum_pid."""
- if os.name == 'nt' or sys.platform == 'cygwin':
- import wpk
- pids = wpk.get_pids(name)
- else:
- data = getoutput(['ps', 'ax']).splitlines()
- pids = [int(line.split()[0]) for line in data if line.find(name) is not -1]
-
- matching_pids = [m for m in pids if m > minimun_pid]
- return matching_pids
-
-def makedirs(name):
-
- head, tail = os.path.split(name)
- if not tail:
- head, tail = os.path.split(head)
- if head and tail and not os.path.exists(head):
- try:
- makedirs(head)
- except OSError, e:
- pass
- if tail == os.curdir: # xxx/newdir/. exists if xxx/newdir exists
- return
- try:
- os.mkdir(name)
- except:
- pass
-
-class Profile(object):
- """Handles all operations regarding profile. Created new profiles, installs extensions,
- sets preferences and handles cleanup."""
-
- def __init__(self, binary=None, profile=None, addons=None,
- preferences=None):
-
- self.binary = binary
-
- self.create_new = not(bool(profile))
- if profile:
- self.profile = profile
- else:
- self.profile = self.create_new_profile(self.binary)
-
- self.addons_installed = []
- self.addons = addons or []
-
- ### set preferences from class preferences
- preferences = preferences or {}
- if hasattr(self.__class__, 'preferences'):
- self.preferences = self.__class__.preferences.copy()
- else:
- self.preferences = {}
- self.preferences.update(preferences)
-
- for addon in self.addons:
- self.install_addon(addon)
-
- self.set_preferences(self.preferences)
-
- def create_new_profile(self, binary):
- """Create a new clean profile in tmp which is a simple empty folder"""
- profile = tempfile.mkdtemp(suffix='.mozrunner')
- return profile
-
- ### methods related to addons
-
- @classmethod
- def addon_id(self, addon_path):
- """
- return the id for a given addon, or None if not found
- - addon_path : path to the addon directory
- """
-
- def find_id(desc):
- """finds the addon id give its description"""
-
- addon_id = None
- for elem in desc:
-
- # remove targetApplication nodes, they contain id's we aren't interested in
- apps = elem.getElementsByTagName('em:targetApplication')
- apps.extend(elem.getElementsByTagName('targetApplication'))
- if apps:
- for app in apps:
- elem.removeChild(app)
-
- # find the id tag
- if elem.getElementsByTagName('em:id'):
- addon_id = str(elem.getElementsByTagName('em:id')[0].firstChild.data)
- elif elem.hasAttribute('em:id'):
- addon_id = str(elem.getAttribute('em:id'))
- elif elem.getElementsByTagName('id'):
- addon_id = str(elem.getElementsByTagName('id')[0].firstChild.data)
-
- return addon_id
-
- doc = minidom.parse(os.path.join(addon_path, 'install.rdf'))
-
- for tag in 'Description', 'RDF:Description':
- desc = doc.getElementsByTagName(tag)
- addon_id = find_id(desc)
- if addon_id:
- return addon_id
-
-
- def install_addon(self, path):
- """Installs the given addon or directory of addons in the profile."""
-
- # if the addon is a directory, install all addons in it
- addons = [path]
- if not path.endswith('.xpi') and not os.path.exists(os.path.join(path, 'install.rdf')):
- addons = [os.path.join(path, x) for x in os.listdir(path)]
-
- # install each addon
- for addon in addons:
- tmpdir = None
-
- # if the addon is an .xpi, uncompress it to a temporary directory
- if addon.endswith('.xpi'):
- tmpdir = tempfile.mkdtemp(suffix = "." + os.path.split(addon)[-1])
- compressed_file = zipfile.ZipFile(addon, "r")
- for name in compressed_file.namelist():
- if name.endswith('/'):
- makedirs(os.path.join(tmpdir, name))
- else:
- if not os.path.isdir(os.path.dirname(os.path.join(tmpdir, name))):
- makedirs(os.path.dirname(os.path.join(tmpdir, name)))
- data = compressed_file.read(name)
- f = open(os.path.join(tmpdir, name), 'wb')
- f.write(data) ; f.close()
- addon = tmpdir
-
- # determine the addon id
- addon_id = Profile.addon_id(addon)
- assert addon_id is not None, "The addon id could not be found: %s" % addon
-
- # copy the addon to the profile
- addon_path = os.path.join(self.profile, 'extensions', addon_id)
- copytree(addon, addon_path, preserve_symlinks=1)
- self.addons_installed.append(addon_path)
-
- # remove the temporary directory, if any
- if tmpdir:
- rmtree(tmpdir)
-
- def clean_addons(self):
- """Cleans up addons in the profile."""
- for addon in self.addons_installed:
- if os.path.isdir(addon):
- rmtree(addon)
-
- ### methods related to preferences
-
- def set_preferences(self, preferences):
- """Adds preferences dict to profile preferences"""
-
- prefs_file = os.path.join(self.profile, 'user.js')
-
- # Ensure that the file exists first otherwise create an empty file
- if os.path.isfile(prefs_file):
- f = open(prefs_file, 'a+')
- else:
- f = open(prefs_file, 'w')
-
- f.write('\n#MozRunner Prefs Start\n')
-
- pref_lines = ['user_pref(%s, %s);' %
- (simplejson.dumps(k), simplejson.dumps(v) ) for k, v in
- preferences.items()]
- for line in pref_lines:
- f.write(line+'\n')
- f.write('#MozRunner Prefs End\n')
- f.flush() ; f.close()
-
- def clean_preferences(self):
- """Removed preferences added by mozrunner."""
- lines = open(os.path.join(self.profile, 'user.js'), 'r').read().splitlines()
- s = lines.index('#MozRunner Prefs Start') ; e = lines.index('#MozRunner Prefs End')
- cleaned_prefs = '\n'.join(lines[:s] + lines[e+1:])
- f = open(os.path.join(self.profile, 'user.js'), 'w')
- f.write(cleaned_prefs) ; f.flush() ; f.close()
-
- ### cleanup
-
- def cleanup(self):
- """Cleanup operations on the profile."""
- def oncleanup_error(function, path, excinfo):
- print >> sys.stderr, "Error Cleaning up: " + str(excinfo[1])
-
- if self.create_new:
- if os.path.exists(self.profile):
- shutil.rmtree(self.profile, False, oncleanup_error)
- else:
- self.clean_preferences()
- self.clean_addons()
-
- __del__ = cleanup
-
-
-class FirefoxProfile(Profile):
- """Specialized Profile subclass for Firefox"""
- preferences = {# Don't automatically update the application
- 'app.update.enabled' : False,
- # Don't restore the last open set of tabs if the browser has crashed
- 'browser.sessionstore.resume_from_crash': False,
- # Don't check for the default web browser
- 'browser.shell.checkDefaultBrowser' : False,
- # Don't warn on exit when multiple tabs are open
- 'browser.tabs.warnOnClose' : False,
- # Don't warn when exiting the browser
- 'browser.warnOnQuit': False,
- # Only install add-ons from the profile
- 'extensions.enabledScopes' : 1,
- # XXX: App-wide extensions are still installed until bug 660898
- # is fixed. Use a workaround for now to disable it.
- 'extensions.installDistroAddons' : False,
- # Dont' run the add-on compatibility check during start-up
- 'extensions.showMismatchUI' : False,
- # Don't automatically update add-ons
- 'extensions.update.enabled' : False,
- # Don't open a dialog to show available add-on updates
- 'extensions.update.notifyUser' : False,
-
- # Disable addon compatibility checks
- 'extensions.checkCompatibility' : False,
- 'extensions.checkCompatibility.4.0' : False,
- 'extensions.checkCompatibility.4.0b' : False,
- 'extensions.checkCompatibility.4.2' : False,
- 'extensions.checkCompatibility.4.2a' : False,
- 'extensions.checkCompatibility.4.2b' : False,
- 'extensions.checkCompatibility.4.2pre' : False,
- 'extensions.checkCompatibility.5.0' : False,
- 'extensions.checkCompatibility.5.0a' : False,
- 'extensions.checkCompatibility.5.0b' : False,
- 'extensions.checkCompatibility.5.0pre' : False,
- 'extensions.checkCompatibility.6.0' : False,
- 'extensions.checkCompatibility.6.0a' : False,
- 'extensions.checkCompatibility.6.0b' : False,
- 'extensions.checkCompatibility.6.0pre' : False,
- }
-
- @property
- def names(self):
- if sys.platform == 'darwin':
- return ['firefox', 'minefield', 'shiretoko']
- if sys.platform.startswith('linux') or sys.platform in ('sunos5', 'solaris'):
- return ['firefox', 'mozilla-firefox', 'iceweasel']
- if os.name == 'nt' or sys.platform == 'cygwin':
- return ['firefox']
-
-class ThunderbirdProfile(Profile):
- preferences = {'extensions.update.enabled' : False,
- 'extensions.update.notifyUser' : False,
- 'browser.shell.checkDefaultBrowser' : False,
- 'browser.tabs.warnOnClose' : False,
- 'browser.warnOnQuit': False,
- 'browser.sessionstore.resume_from_crash': False,
- }
- names = ["thunderbird", "shredder"]
-
-
-class Runner(object):
- """Handles all running operations. Finds bins, runs and kills the process."""
-
- def __init__(self, binary=None, profile=None, cmdargs=[], env=None, kp_kwargs={}):
-
- self.process_handler = None
-
- # find the binary
- if binary is None:
- self.binary = self.find_binary()
- elif sys.platform == 'darwin' and binary.find('Contents/MacOS/') == -1:
- self.binary = os.path.join(binary, 'Contents/MacOS/%s-bin' % self.names[0])
- else:
- self.binary = binary
- if not os.path.exists(self.binary):
- raise Exception("Binary path does not exist "+self.binary)
-
-
- if sys.platform.startswith('linux') and self.binary.endswith('-bin'):
- dirname = os.path.dirname(self.binary)
- if os.environ.get('LD_LIBRARY_PATH', None):
- os.environ['LD_LIBRARY_PATH'] = '%s:%s' % (os.environ['LD_LIBRARY_PATH'], dirname)
- else:
- os.environ['LD_LIBRARY_PATH'] = dirname
-
- self.profile = profile
-
- self.cmdargs = cmdargs
- if env is None:
- self.env = copy.copy(os.environ)
- self.env.update({'MOZ_NO_REMOTE':"1",})
- else:
- self.env = env
- self.kp_kwargs = kp_kwargs
-
- def find_binary(self):
- """Finds the binary for self.names if one was not provided."""
- binary = None
- if sys.platform.startswith('linux') or sys.platform in ('sunos5', 'solaris'):
- for name in reversed(self.names):
- binary = findInPath(name)
- elif os.name == 'nt' or sys.platform == 'cygwin':
-
- # find the default executable from the windows registry
- try:
- # assumes self.app_name is defined, as it should be for
- # implementors
- import _winreg
- app_key = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, r"Software\Mozilla\Mozilla %s" % self.app_name)
- version, _type = _winreg.QueryValueEx(app_key, "CurrentVersion")
- version_key = _winreg.OpenKey(app_key, version + r"\Main")
- path, _ = _winreg.QueryValueEx(version_key, "PathToExe")
- return path
- except: # XXX not sure what type of exception this should be
- pass
-
- # search for the binary in the path
- for name in reversed(self.names):
- binary = findInPath(name)
- if sys.platform == 'cygwin':
- program_files = os.environ['PROGRAMFILES']
- else:
- program_files = os.environ['ProgramFiles']
-
- if binary is None:
- for bin in [(program_files, 'Mozilla Firefox', 'firefox.exe'),
- (os.environ.get("ProgramFiles(x86)"),'Mozilla Firefox', 'firefox.exe'),
- (program_files,'Minefield', 'firefox.exe'),
- (os.environ.get("ProgramFiles(x86)"),'Minefield', 'firefox.exe')
- ]:
- path = os.path.join(*bin)
- if os.path.isfile(path):
- binary = path
- break
- elif sys.platform == 'darwin':
- for name in reversed(self.names):
- appdir = os.path.join('Applications', name.capitalize()+'.app')
- if os.path.isdir(os.path.join(os.path.expanduser('~/'), appdir)):
- binary = os.path.join(os.path.expanduser('~/'), appdir,
- 'Contents/MacOS/'+name+'-bin')
- elif os.path.isdir('/'+appdir):
- binary = os.path.join("/"+appdir, 'Contents/MacOS/'+name+'-bin')
-
- if binary is not None:
- if not os.path.isfile(binary):
- binary = binary.replace(name+'-bin', 'firefox-bin')
- if not os.path.isfile(binary):
- binary = None
- if binary is None:
- raise Exception('Mozrunner could not locate your binary, you will need to set it.')
- return binary
-
- @property
- def command(self):
- """Returns the command list to run."""
- cmd = [self.binary, '-profile', self.profile.profile]
- # On i386 OS X machines, i386+x86_64 universal binaries need to be told
- # to run as i386 binaries. If we're not running a i386+x86_64 universal
- # binary, then this command modification is harmless.
- if sys.platform == 'darwin':
- if hasattr(platform, 'architecture') and platform.architecture()[0] == '32bit':
- cmd = ['arch', '-i386'] + cmd
- return cmd
-
- def get_repositoryInfo(self):
- """Read repository information from application.ini and platform.ini."""
- import ConfigParser
-
- config = ConfigParser.RawConfigParser()
- dirname = os.path.dirname(self.binary)
- repository = { }
-
- for entry in [['application', 'App'], ['platform', 'Build']]:
- (file, section) = entry
- config.read(os.path.join(dirname, '%s.ini' % file))
-
- for entry in [['SourceRepository', 'repository'], ['SourceStamp', 'changeset']]:
- (key, id) = entry
-
- try:
- repository['%s_%s' % (file, id)] = config.get(section, key);
- except:
- repository['%s_%s' % (file, id)] = None
-
- return repository
-
- def start(self):
- """Run self.command in the proper environment."""
- if self.profile is None:
- self.profile = self.profile_class()
- self.process_handler = run_command(self.command+self.cmdargs, self.env, **self.kp_kwargs)
-
- def wait(self, timeout=None):
- """Wait for the browser to exit."""
- self.process_handler.wait(timeout=timeout)
-
- if sys.platform != 'win32':
- for name in self.names:
- for pid in get_pids(name, self.process_handler.pid):
- self.process_handler.pid = pid # bad touch!
- self.process_handler.wait(timeout=timeout)
-
- def stop(self):
- """Kill the browser"""
-
- if not self.process_handler:
- return
-
- if sys.platform != 'win32':
- self.process_handler.kill()
- for name in self.names:
- for pid in get_pids(name, self.process_handler.pid):
- self.process_handler.pid = pid # bad touch!
- self.process_handler.kill()
- else:
- try:
- self.process_handler.kill(group=True)
- # On windows, it sometimes behooves one to wait for dust to settle
- # after killing processes. Let's try that.
- # TODO: Bug 640047 is invesitgating the correct way to handle this case
- self.process_handler.wait(timeout=10)
-
- except Exception, e:
- logger.error('Cannot kill process, '+type(e).__name__+' '+e.message)
-
- def cleanup(self):
- self.stop()
- if self.profile:
- self.profile.cleanup()
-
- __del__ = cleanup
-
-
-class FirefoxRunner(Runner):
- """Specialized Runner subclass for running Firefox."""
-
- app_name = 'Firefox'
- profile_class = FirefoxProfile
-
- @property
- def names(self):
- if sys.platform == 'darwin':
- return ['firefox', 'minefield', 'shiretoko']
- if sys.platform.startswith('linux') or (sys.platform in ('sunos5', 'solaris')):
- return ['firefox', 'mozilla-firefox', 'iceweasel']
- if os.name == 'nt' or sys.platform == 'cygwin':
- return ['firefox']
-
-class ThunderbirdRunner(Runner):
- """Specialized Runner subclass for running Thunderbird"""
-
- app_name = 'Thunderbird'
- profile_class = ThunderbirdProfile
-
- names = ["thunderbird", "shredder"]
-
-class CLI(object):
- """Command line interface."""
-
- runner_class = FirefoxRunner
- profile_class = FirefoxProfile
- module = "mozrunner"
-
- parser_options = {("-b", "--binary",): dict(dest="binary", help="Binary path.",
- metavar=None, default=None),
- ('-p', "--profile",): dict(dest="profile", help="Profile path.",
- metavar=None, default=None),
- ('-a', "--addons",): dict(dest="addons",
- help="Addons paths to install.",
- metavar=None, default=None),
- ("--info",): dict(dest="info", default=False,
- action="store_true",
- help="Print module information")
- }
-
- def __init__(self):
- """ Setup command line parser and parse arguments """
- self.metadata = self.get_metadata_from_egg()
- self.parser = optparse.OptionParser(version="%prog " + self.metadata["Version"])
- for names, opts in self.parser_options.items():
- self.parser.add_option(*names, **opts)
- (self.options, self.args) = self.parser.parse_args()
-
- if self.options.info:
- self.print_metadata()
- sys.exit(0)
-
- # XXX should use action='append' instead of rolling our own
- try:
- self.addons = self.options.addons.split(',')
- except:
- self.addons = []
-
- def get_metadata_from_egg(self):
- import pkg_resources
- ret = {}
- dist = pkg_resources.get_distribution(self.module)
- if dist.has_metadata("PKG-INFO"):
- for line in dist.get_metadata_lines("PKG-INFO"):
- key, value = line.split(':', 1)
- ret[key] = value
- if dist.has_metadata("requires.txt"):
- ret["Dependencies"] = "\n" + dist.get_metadata("requires.txt")
- return ret
-
- def print_metadata(self, data=("Name", "Version", "Summary", "Home-page",
- "Author", "Author-email", "License", "Platform", "Dependencies")):
- for key in data:
- if key in self.metadata:
- print key + ": " + self.metadata[key]
-
- def create_runner(self):
- """ Get the runner object """
- runner = self.get_runner(binary=self.options.binary)
- profile = self.get_profile(binary=runner.binary,
- profile=self.options.profile,
- addons=self.addons)
- runner.profile = profile
- return runner
-
- def get_runner(self, binary=None, profile=None):
- """Returns the runner instance for the given command line binary argument
- the profile instance returned from self.get_profile()."""
- return self.runner_class(binary, profile)
-
- def get_profile(self, binary=None, profile=None, addons=None, preferences=None):
- """Returns the profile instance for the given command line arguments."""
- addons = addons or []
- preferences = preferences or {}
- return self.profile_class(binary, profile, addons, preferences)
-
- def run(self):
- runner = self.create_runner()
- self.start(runner)
- runner.profile.cleanup()
-
- def start(self, runner):
- """Starts the runner and waits for Firefox to exitor Keyboard Interrupt.
- Shoule be overwritten to provide custom running of the runner instance."""
- runner.start()
- print 'Started:', ' '.join(runner.command)
- try:
- runner.wait()
- except KeyboardInterrupt:
- runner.stop()
-
-
-def cli():
- CLI().run()
-
-def print_addon_ids(args=sys.argv[1:]):
- """print addon ids for testing"""
- for arg in args:
- print Profile.addon_id(arg)
-
-
deleted file mode 100644
--- a/mail/test/resources/mozrunner/mozrunner/killableprocess.py
+++ /dev/null
@@ -1,311 +0,0 @@
-# killableprocess - subprocesses which can be reliably killed
-#
-# Parts of this module are copied from the subprocess.py file contained
-# in the Python distribution.
-#
-# Copyright (c) 2003-2004 by Peter Astrand <astrand@lysator.liu.se>
-#
-# Additions and modifications written by Benjamin Smedberg
-# <benjamin@smedbergs.us> are Copyright (c) 2006 by the Mozilla Foundation
-# <http://www.mozilla.org/>
-#
-# More Modifications
-# Copyright (c) 2006-2007 by Mike Taylor <bear@code-bear.com>
-# Copyright (c) 2007-2008 by Mikeal Rogers <mikeal@mozilla.com>
-#
-# By obtaining, using, and/or copying this software and/or its
-# associated documentation, you agree that you have read, understood,
-# and will comply with the following terms and conditions:
-#
-# Permission to use, copy, modify, and distribute this software and
-# its associated documentation for any purpose and without fee is
-# hereby granted, provided that the above copyright notice appears in
-# all copies, and that both that copyright notice and this permission
-# notice appear in supporting documentation, and that the name of the
-# author not be used in advertising or publicity pertaining to
-# distribution of the software without specific, written prior
-# permission.
-#
-# THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
-# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, INDIRECT OR
-# CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
-# OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
-# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
-# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
-"""killableprocess - Subprocesses which can be reliably killed
-
-This module is a subclass of the builtin "subprocess" module. It allows
-processes that launch subprocesses to be reliably killed on Windows (via the Popen.kill() method.
-
-It also adds a timeout argument to Wait() for a limited period of time before
-forcefully killing the process.
-
-Note: On Windows, this module requires Windows 2000 or higher (no support for
-Windows 95, 98, or NT 4.0). It also requires ctypes, which is bundled with
-Python 2.5+ or available from http://python.net/crew/theller/ctypes/
-"""
-
-import subprocess
-import sys
-import os
-import time
-import datetime
-import types
-import exceptions
-
-try:
- from subprocess import CalledProcessError
-except ImportError:
- # Python 2.4 doesn't implement CalledProcessError
- class CalledProcessError(Exception):
- """This exception is raised when a process run by check_call() returns
- a non-zero exit status. The exit status will be stored in the
- returncode attribute."""
- def __init__(self, returncode, cmd):
- self.returncode = returncode
- self.cmd = cmd
- def __str__(self):
- return "Command '%s' returned non-zero exit status %d" % (self.cmd, self.returncode)
-
-mswindows = (sys.platform == "win32")
-
-if mswindows:
- import winprocess
-else:
- import signal
-
-def call(*args, **kwargs):
- waitargs = {}
- if "timeout" in kwargs:
- waitargs["timeout"] = kwargs.pop("timeout")
-
- return Popen(*args, **kwargs).wait(**waitargs)
-
-def check_call(*args, **kwargs):
- """Call a program with an optional timeout. If the program has a non-zero
- exit status, raises a CalledProcessError."""
-
- retcode = call(*args, **kwargs)
- if retcode:
- cmd = kwargs.get("args")
- if cmd is None:
- cmd = args[0]
- raise CalledProcessError(retcode, cmd)
-
-if not mswindows:
- def DoNothing(*args):
- pass
-
-class Popen(subprocess.Popen):
- kill_called = False
- if mswindows:
- def _execute_child(self, args, executable, preexec_fn, close_fds,
- cwd, env, universal_newlines, startupinfo,
- creationflags, shell,
- p2cread, p2cwrite,
- c2pread, c2pwrite,
- errread, errwrite):
- if not isinstance(args, types.StringTypes):
- args = subprocess.list2cmdline(args)
-
- # Always or in the create new process group
- creationflags |= winprocess.CREATE_NEW_PROCESS_GROUP
-
- if startupinfo is None:
- startupinfo = winprocess.STARTUPINFO()
-
- if None not in (p2cread, c2pwrite, errwrite):
- startupinfo.dwFlags |= winprocess.STARTF_USESTDHANDLES
-
- startupinfo.hStdInput = int(p2cread)
- startupinfo.hStdOutput = int(c2pwrite)
- startupinfo.hStdError = int(errwrite)
- if shell:
- startupinfo.dwFlags |= winprocess.STARTF_USESHOWWINDOW
- startupinfo.wShowWindow = winprocess.SW_HIDE
- comspec = os.environ.get("COMSPEC", "cmd.exe")
- args = comspec + " /c " + args
-
- # determine if we can create create a job
- canCreateJob = winprocess.CanCreateJobObject()
-
- # set process creation flags
- creationflags |= winprocess.CREATE_SUSPENDED
- creationflags |= winprocess.CREATE_UNICODE_ENVIRONMENT
- if canCreateJob:
- # Uncomment this line below to discover very useful things about your environment
- #print "++++ killableprocess: releng twistd patch not applied, we can create job objects"
- creationflags |= winprocess.CREATE_BREAKAWAY_FROM_JOB
-
- # create the process
- hp, ht, pid, tid = winprocess.CreateProcess(
- executable, args,
- None, None, # No special security
- 1, # Must inherit handles!
- creationflags,
- winprocess.EnvironmentBlock(env),
- cwd, startupinfo)
- self._child_created = True
- self._handle = hp
- self._thread = ht
- self.pid = pid
- self.tid = tid
-
- if canCreateJob:
- # We create a new job for this process, so that we can kill
- # the process and any sub-processes
- self._job = winprocess.CreateJobObject()
- winprocess.AssignProcessToJobObject(self._job, int(hp))
- else:
- self._job = None
-
- winprocess.ResumeThread(int(ht))
- ht.Close()
-
- if p2cread is not None:
- p2cread.Close()
- if c2pwrite is not None:
- c2pwrite.Close()
- if errwrite is not None:
- errwrite.Close()
- time.sleep(.1)
-
- def kill(self, group=True):
- """Kill the process. If group=True, all sub-processes will also be killed."""
- self.kill_called = True
-
- if mswindows:
- if group and self._job:
- winprocess.TerminateJobObject(self._job, 127)
- else:
- winprocess.TerminateProcess(self._handle, 127)
- self.returncode = 127
- else:
- if group:
- try:
- os.killpg(self.pid, signal.SIGKILL)
- except: pass
- else:
- os.kill(self.pid, signal.SIGKILL)
- self.returncode = -9
-
- def wait(self, timeout=None, group=True):
- """Wait for the process to terminate. Returns returncode attribute.
- If timeout seconds are reached and the process has not terminated,
- it will be forcefully killed. If timeout is -1, wait will not
- time out."""
- if timeout is not None:
- # timeout is now in milliseconds
- timeout = timeout * 1000
-
- starttime = datetime.datetime.now()
-
- if mswindows:
- if timeout is None:
- timeout = -1
- rc = winprocess.WaitForSingleObject(self._handle, timeout)
-
- if (rc == winprocess.WAIT_OBJECT_0 or
- rc == winprocess.WAIT_ABANDONED or
- rc == winprocess.WAIT_FAILED):
- # Object has either signaled, or the API call has failed. In
- # both cases we want to give the OS the benefit of the doubt
- # and supply a little time before we start shooting processes
- # with an M-16.
-
- # Returns 1 if running, 0 if not, -1 if timed out
- def check():
- now = datetime.datetime.now()
- diff = now - starttime
- if (diff.seconds * 1000 * 1000 + diff.microseconds) < (timeout * 1000):
- if self._job:
- if (winprocess.QueryInformationJobObject(self._job, 8)['BasicInfo']['ActiveProcesses'] > 0):
- # Job Object is still containing active processes
- return 1
- else:
- # No job, we use GetExitCodeProcess, which will tell us if the process is still active
- self.returncode = winprocess.GetExitCodeProcess(self._handle)
- if (self.returncode == winprocess.STILL_ACTIVE):
- # Process still active, continue waiting
- return 1
- # Process not active, return 0
- return 0
- else:
- # Timed out, return -1
- return -1
-
- notdone = check()
- while notdone == 1:
- time.sleep(.5)
- notdone = check()
-
- if notdone == -1:
- # Then check timed out, we have a hung process, attempt
- # last ditch kill with explosives
- self.kill(group)
-
- else:
- # In this case waitforsingleobject timed out. We have to
- # take the process behind the woodshed and shoot it.
- self.kill(group)
-
- else:
- if sys.platform.startswith('linux') or (sys.platform in ('sunos5', 'solaris')):
- def group_wait(timeout):
- try:
- os.waitpid(self.pid, 0)
- except OSError, e:
- pass # If wait has already been called on this pid, bad things happen
- return self.returncode
- elif sys.platform == 'darwin':
- def group_wait(timeout):
- try:
- count = 0
- if timeout is None and self.kill_called:
- timeout = 10 # Have to set some kind of timeout or else this could go on forever
- if timeout is None:
- while 1:
- os.killpg(self.pid, signal.SIG_DFL)
- while ((count * 2) <= timeout):
- os.killpg(self.pid, signal.SIG_DFL)
- # count is increased by 500ms for every 0.5s of sleep
- time.sleep(.5); count += 500
- except exceptions.OSError:
- return self.returncode
-
- if timeout is None:
- if group is True:
- return group_wait(timeout)
- else:
- subprocess.Popen.wait(self)
- return self.returncode
-
- returncode = False
-
- now = datetime.datetime.now()
- diff = now - starttime
- while (diff.seconds * 1000 * 1000 + diff.microseconds) < (timeout * 1000) and ( returncode is False ):
- if group is True:
- return group_wait(timeout)
- else:
- if subprocess.poll() is not None:
- returncode = self.returncode
- time.sleep(.5)
- now = datetime.datetime.now()
- diff = now - starttime
- return self.returncode
-
- return self.returncode
- # We get random maxint errors from subprocesses __del__
- __del__ = lambda self: None
-
-def setpgid_preexec_fn():
- os.setpgid(0, 0)
-
-def runCommand(cmd, **kwargs):
- if sys.platform != "win32":
- return Popen(cmd, preexec_fn=setpgid_preexec_fn, **kwargs)
- else:
- return Popen(cmd, **kwargs)
deleted file mode 100644
--- a/mail/test/resources/mozrunner/mozrunner/qijo.py
+++ /dev/null
@@ -1,162 +0,0 @@
-from ctypes import c_void_p, POINTER, sizeof, Structure, windll, WinError, WINFUNCTYPE, addressof, c_size_t, c_ulong
-from ctypes.wintypes import BOOL, BYTE, DWORD, HANDLE, LARGE_INTEGER
-
-LPVOID = c_void_p
-LPDWORD = POINTER(DWORD)
-SIZE_T = c_size_t
-ULONG_PTR = POINTER(c_ulong)
-
-# A ULONGLONG is a 64-bit unsigned integer.
-# Thus there are 8 bytes in a ULONGLONG.
-# XXX why not import c_ulonglong ?
-ULONGLONG = BYTE * 8
-
-class IO_COUNTERS(Structure):
- # The IO_COUNTERS struct is 6 ULONGLONGs.
- # TODO: Replace with non-dummy fields.
- _fields_ = [('dummy', ULONGLONG * 6)]
-
-class JOBOBJECT_BASIC_ACCOUNTING_INFORMATION(Structure):
- _fields_ = [('TotalUserTime', LARGE_INTEGER),
- ('TotalKernelTime', LARGE_INTEGER),
- ('ThisPeriodTotalUserTime', LARGE_INTEGER),
- ('ThisPeriodTotalKernelTime', LARGE_INTEGER),
- ('TotalPageFaultCount', DWORD),
- ('TotalProcesses', DWORD),
- ('ActiveProcesses', DWORD),
- ('TotalTerminatedProcesses', DWORD)]
-
-class JOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION(Structure):
- _fields_ = [('BasicInfo', JOBOBJECT_BASIC_ACCOUNTING_INFORMATION),
- ('IoInfo', IO_COUNTERS)]
-
-# see http://msdn.microsoft.com/en-us/library/ms684147%28VS.85%29.aspx
-class JOBOBJECT_BASIC_LIMIT_INFORMATION(Structure):
- _fields_ = [('PerProcessUserTimeLimit', LARGE_INTEGER),
- ('PerJobUserTimeLimit', LARGE_INTEGER),
- ('LimitFlags', DWORD),
- ('MinimumWorkingSetSize', SIZE_T),
- ('MaximumWorkingSetSize', SIZE_T),
- ('ActiveProcessLimit', DWORD),
- ('Affinity', ULONG_PTR),
- ('PriorityClass', DWORD),
- ('SchedulingClass', DWORD)
- ]
-
-# see http://msdn.microsoft.com/en-us/library/ms684156%28VS.85%29.aspx
-class JOBOBJECT_EXTENDED_LIMIT_INFORMATION(Structure):
- _fields_ = [('BasicLimitInformation', JOBOBJECT_BASIC_LIMIT_INFORMATION),
- ('IoInfo', IO_COUNTERS),
- ('ProcessMemoryLimit', SIZE_T),
- ('JobMemoryLimit', SIZE_T),
- ('PeakProcessMemoryUsed', SIZE_T),
- ('PeakJobMemoryUsed', SIZE_T)]
-
-# XXX Magical numbers like 8 should be documented
-JobObjectBasicAndIoAccountingInformation = 8
-
-# ...like magical number 9 comes from
-# http://community.flexerasoftware.com/archive/index.php?t-181670.html
-# I wish I had a more canonical source
-JobObjectExtendedLimitInformation = 9
-
-class JobObjectInfo(object):
- mapping = { 'JobObjectBasicAndIoAccountingInformation': 8,
- 'JobObjectExtendedLimitInformation': 9
- }
- structures = { 8: JOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION,
- 9: JOBOBJECT_EXTENDED_LIMIT_INFORMATION
- }
- def __init__(self, _class):
- if isinstance(_class, basestring):
- assert _class in self.mapping, 'Class should be one of %s; you gave %s' % (self.mapping, _class)
- _class = self.mapping[_class]
- assert _class in self.structures, 'Class should be one of %s; you gave %s' % (self.structures, _class)
- self.code = _class
- self.info = self.structures[_class]()
-
-
-QueryInformationJobObjectProto = WINFUNCTYPE(
- BOOL, # Return type
- HANDLE, # hJob
- DWORD, # JobObjectInfoClass
- LPVOID, # lpJobObjectInfo
- DWORD, # cbJobObjectInfoLength
- LPDWORD # lpReturnLength
- )
-
-QueryInformationJobObjectFlags = (
- (1, 'hJob'),
- (1, 'JobObjectInfoClass'),
- (1, 'lpJobObjectInfo'),
- (1, 'cbJobObjectInfoLength'),
- (1, 'lpReturnLength', None)
- )
-
-_QueryInformationJobObject = QueryInformationJobObjectProto(
- ('QueryInformationJobObject', windll.kernel32),
- QueryInformationJobObjectFlags
- )
-
-class SubscriptableReadOnlyStruct(object):
- def __init__(self, struct):
- self._struct = struct
-
- def _delegate(self, name):
- result = getattr(self._struct, name)
- if isinstance(result, Structure):
- return SubscriptableReadOnlyStruct(result)
- return result
-
- def __getitem__(self, name):
- match = [fname for fname, ftype in self._struct._fields_
- if fname == name]
- if match:
- return self._delegate(name)
- raise KeyError(name)
-
- def __getattr__(self, name):
- return self._delegate(name)
-
-def QueryInformationJobObject(hJob, JobObjectInfoClass):
- jobinfo = JobObjectInfo(JobObjectInfoClass)
- result = _QueryInformationJobObject(
- hJob=hJob,
- JobObjectInfoClass=jobinfo.code,
- lpJobObjectInfo=addressof(jobinfo.info),
- cbJobObjectInfoLength=sizeof(jobinfo.info)
- )
- if not result:
- raise WinError()
- return SubscriptableReadOnlyStruct(jobinfo.info)
-
-def test_qijo():
- from killableprocess import Popen
-
- popen = Popen('c:\\windows\\notepad.exe')
-
- try:
- result = QueryInformationJobObject(0, 8)
- raise AssertionError('throw should occur')
- except WindowsError, e:
- pass
-
- try:
- result = QueryInformationJobObject(0, 1)
- raise AssertionError('throw should occur')
- except NotImplementedError, e:
- pass
-
- result = QueryInformationJobObject(popen._job, 8)
- if result['BasicInfo']['ActiveProcesses'] != 1:
- raise AssertionError('expected ActiveProcesses to be 1')
- popen.kill()
-
- result = QueryInformationJobObject(popen._job, 8)
- if result.BasicInfo.ActiveProcesses != 0:
- raise AssertionError('expected ActiveProcesses to be 0')
-
-if __name__ == '__main__':
- print "testing."
- test_qijo()
- print "success!"
deleted file mode 100644
--- a/mail/test/resources/mozrunner/mozrunner/winprocess.py
+++ /dev/null
@@ -1,387 +0,0 @@
-# A module to expose various thread/process/job related structures and
-# methods from kernel32
-#
-# The MIT License
-#
-# Copyright (c) 2003-2004 by Peter Astrand <astrand@lysator.liu.se>
-#
-# Additions and modifications written by Benjamin Smedberg
-# <benjamin@smedbergs.us> are Copyright (c) 2006 by the Mozilla Foundation
-# <http://www.mozilla.org/>
-#
-# More Modifications
-# Copyright (c) 2006-2007 by Mike Taylor <bear@code-bear.com>
-# Copyright (c) 2007-2008 by Mikeal Rogers <mikeal@mozilla.com>
-#
-# By obtaining, using, and/or copying this software and/or its
-# associated documentation, you agree that you have read, understood,
-# and will comply with the following terms and conditions:
-#
-# Permission to use, copy, modify, and distribute this software and
-# its associated documentation for any purpose and without fee is
-# hereby granted, provided that the above copyright notice appears in
-# all copies, and that both that copyright notice and this permission
-# notice appear in supporting documentation, and that the name of the
-# author not be used in advertising or publicity pertaining to
-# distribution of the software without specific, written prior
-# permission.
-#
-# THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
-# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, INDIRECT OR
-# CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
-# OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
-# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
-# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
-from ctypes import c_void_p, POINTER, sizeof, Structure, windll, WinError, WINFUNCTYPE
-from ctypes.wintypes import BOOL, BYTE, DWORD, HANDLE, LPCWSTR, LPWSTR, UINT, WORD
-from qijo import QueryInformationJobObject
-
-# Because we do not want to depend on pywin32, we cannot get win32con which
-# contains this nifty little constant. The constant has had the magic value
-# of 259 for a long time (since win2k as far as I can tell).
-STILL_ACTIVE = 259
-
-LPVOID = c_void_p
-LPBYTE = POINTER(BYTE)
-LPDWORD = POINTER(DWORD)
-LPBOOL = POINTER(BOOL)
-
-def ErrCheckBool(result, func, args):
- """errcheck function for Windows functions that return a BOOL True
- on success"""
- if not result:
- raise WinError()
- return args
-
-
-# AutoHANDLE
-
-class AutoHANDLE(HANDLE):
- """Subclass of HANDLE which will call CloseHandle() on deletion."""
-
- CloseHandleProto = WINFUNCTYPE(BOOL, HANDLE)
- CloseHandle = CloseHandleProto(("CloseHandle", windll.kernel32))
- CloseHandle.errcheck = ErrCheckBool
-
- def Close(self):
- if self.value and self.value != HANDLE(-1).value:
- self.CloseHandle(self)
- self.value = 0
-
- def __del__(self):
- self.Close()
-
- def __int__(self):
- return self.value
-
-def ErrCheckHandle(result, func, args):
- """errcheck function for Windows functions that return a HANDLE."""
- if not result:
- raise WinError()
- return AutoHANDLE(result)
-
-# PROCESS_INFORMATION structure
-
-class PROCESS_INFORMATION(Structure):
- _fields_ = [("hProcess", HANDLE),
- ("hThread", HANDLE),
- ("dwProcessID", DWORD),
- ("dwThreadID", DWORD)]
-
- def __init__(self):
- Structure.__init__(self)
-
- self.cb = sizeof(self)
-
-LPPROCESS_INFORMATION = POINTER(PROCESS_INFORMATION)
-
-# STARTUPINFO structure
-
-class STARTUPINFO(Structure):
- _fields_ = [("cb", DWORD),
- ("lpReserved", LPWSTR),
- ("lpDesktop", LPWSTR),
- ("lpTitle", LPWSTR),
- ("dwX", DWORD),
- ("dwY", DWORD),
- ("dwXSize", DWORD),
- ("dwYSize", DWORD),
- ("dwXCountChars", DWORD),
- ("dwYCountChars", DWORD),
- ("dwFillAttribute", DWORD),
- ("dwFlags", DWORD),
- ("wShowWindow", WORD),
- ("cbReserved2", WORD),
- ("lpReserved2", LPBYTE),
- ("hStdInput", HANDLE),
- ("hStdOutput", HANDLE),
- ("hStdError", HANDLE)
- ]
-LPSTARTUPINFO = POINTER(STARTUPINFO)
-
-SW_HIDE = 0
-
-STARTF_USESHOWWINDOW = 0x01
-STARTF_USESIZE = 0x02
-STARTF_USEPOSITION = 0x04
-STARTF_USECOUNTCHARS = 0x08
-STARTF_USEFILLATTRIBUTE = 0x10
-STARTF_RUNFULLSCREEN = 0x20
-STARTF_FORCEONFEEDBACK = 0x40
-STARTF_FORCEOFFFEEDBACK = 0x80
-STARTF_USESTDHANDLES = 0x100
-
-# EnvironmentBlock
-
-class EnvironmentBlock:
- """An object which can be passed as the lpEnv parameter of CreateProcess.
- It is initialized with a dictionary."""
-
- def __init__(self, dict):
- if not dict:
- self._as_parameter_ = None
- else:
- values = ["%s=%s" % (key, value)
- for (key, value) in dict.iteritems()]
- values.append("")
- self._as_parameter_ = LPCWSTR("\0".join(values))
-
-# CreateProcess()
-
-CreateProcessProto = WINFUNCTYPE(BOOL, # Return type
- LPCWSTR, # lpApplicationName
- LPWSTR, # lpCommandLine
- LPVOID, # lpProcessAttributes
- LPVOID, # lpThreadAttributes
- BOOL, # bInheritHandles
- DWORD, # dwCreationFlags
- LPVOID, # lpEnvironment
- LPCWSTR, # lpCurrentDirectory
- LPSTARTUPINFO, # lpStartupInfo
- LPPROCESS_INFORMATION # lpProcessInformation
- )
-
-CreateProcessFlags = ((1, "lpApplicationName", None),
- (1, "lpCommandLine"),
- (1, "lpProcessAttributes", None),
- (1, "lpThreadAttributes", None),
- (1, "bInheritHandles", True),
- (1, "dwCreationFlags", 0),
- (1, "lpEnvironment", None),
- (1, "lpCurrentDirectory", None),
- (1, "lpStartupInfo"),
- (2, "lpProcessInformation"))
-
-def ErrCheckCreateProcess(result, func, args):
- ErrCheckBool(result, func, args)
- # return a tuple (hProcess, hThread, dwProcessID, dwThreadID)
- pi = args[9]
- return AutoHANDLE(pi.hProcess), AutoHANDLE(pi.hThread), pi.dwProcessID, pi.dwThreadID
-
-CreateProcess = CreateProcessProto(("CreateProcessW", windll.kernel32),
- CreateProcessFlags)
-CreateProcess.errcheck = ErrCheckCreateProcess
-
-# flags for CreateProcess
-CREATE_BREAKAWAY_FROM_JOB = 0x01000000
-CREATE_DEFAULT_ERROR_MODE = 0x04000000
-CREATE_NEW_CONSOLE = 0x00000010
-CREATE_NEW_PROCESS_GROUP = 0x00000200
-CREATE_NO_WINDOW = 0x08000000
-CREATE_SUSPENDED = 0x00000004
-CREATE_UNICODE_ENVIRONMENT = 0x00000400
-
-# flags for job limit information
-# see http://msdn.microsoft.com/en-us/library/ms684147%28VS.85%29.aspx
-JOB_OBJECT_LIMIT_BREAKAWAY_OK = 0x00000800
-JOB_OBJECT_LIMIT_SILENT_BREAKAWAY_OK = 0x00001000
-
-# XXX these flags should be documented
-DEBUG_ONLY_THIS_PROCESS = 0x00000002
-DEBUG_PROCESS = 0x00000001
-DETACHED_PROCESS = 0x00000008
-
-# CreateJobObject()
-
-CreateJobObjectProto = WINFUNCTYPE(HANDLE, # Return type
- LPVOID, # lpJobAttributes
- LPCWSTR # lpName
- )
-
-CreateJobObjectFlags = ((1, "lpJobAttributes", None),
- (1, "lpName", None))
-
-CreateJobObject = CreateJobObjectProto(("CreateJobObjectW", windll.kernel32),
- CreateJobObjectFlags)
-CreateJobObject.errcheck = ErrCheckHandle
-
-# AssignProcessToJobObject()
-
-AssignProcessToJobObjectProto = WINFUNCTYPE(BOOL, # Return type
- HANDLE, # hJob
- HANDLE # hProcess
- )
-AssignProcessToJobObjectFlags = ((1, "hJob"),
- (1, "hProcess"))
-AssignProcessToJobObject = AssignProcessToJobObjectProto(
- ("AssignProcessToJobObject", windll.kernel32),
- AssignProcessToJobObjectFlags)
-AssignProcessToJobObject.errcheck = ErrCheckBool
-
-# GetCurrentProcess()
-# because os.getPid() is way too easy
-GetCurrentProcessProto = WINFUNCTYPE(HANDLE # Return type
- )
-GetCurrentProcessFlags = ()
-GetCurrentProcess = GetCurrentProcessProto(
- ("GetCurrentProcess", windll.kernel32),
- GetCurrentProcessFlags)
-GetCurrentProcess.errcheck = ErrCheckHandle
-
-# IsProcessInJob()
-try:
- IsProcessInJobProto = WINFUNCTYPE(BOOL, # Return type
- HANDLE, # Process Handle
- HANDLE, # Job Handle
- LPBOOL # Result
- )
- IsProcessInJobFlags = ((1, "ProcessHandle"),
- (1, "JobHandle", HANDLE(0)),
- (2, "Result"))
- IsProcessInJob = IsProcessInJobProto(
- ("IsProcessInJob", windll.kernel32),
- IsProcessInJobFlags)
- IsProcessInJob.errcheck = ErrCheckBool
-except AttributeError:
- # windows 2k doesn't have this API
- def IsProcessInJob(process):
- return False
-
-
-# ResumeThread()
-
-def ErrCheckResumeThread(result, func, args):
- if result == -1:
- raise WinError()
-
- return args
-
-ResumeThreadProto = WINFUNCTYPE(DWORD, # Return type
- HANDLE # hThread
- )
-ResumeThreadFlags = ((1, "hThread"),)
-ResumeThread = ResumeThreadProto(("ResumeThread", windll.kernel32),
- ResumeThreadFlags)
-ResumeThread.errcheck = ErrCheckResumeThread
-
-# TerminateProcess()
-
-TerminateProcessProto = WINFUNCTYPE(BOOL, # Return type
- HANDLE, # hProcess
- UINT # uExitCode
- )
-TerminateProcessFlags = ((1, "hProcess"),
- (1, "uExitCode", 127))
-TerminateProcess = TerminateProcessProto(
- ("TerminateProcess", windll.kernel32),
- TerminateProcessFlags)
-TerminateProcess.errcheck = ErrCheckBool
-
-# TerminateJobObject()
-
-TerminateJobObjectProto = WINFUNCTYPE(BOOL, # Return type
- HANDLE, # hJob
- UINT # uExitCode
- )
-TerminateJobObjectFlags = ((1, "hJob"),
- (1, "uExitCode", 127))
-TerminateJobObject = TerminateJobObjectProto(
- ("TerminateJobObject", windll.kernel32),
- TerminateJobObjectFlags)
-TerminateJobObject.errcheck = ErrCheckBool
-
-# WaitForSingleObject()
-
-WaitForSingleObjectProto = WINFUNCTYPE(DWORD, # Return type
- HANDLE, # hHandle
- DWORD, # dwMilliseconds
- )
-WaitForSingleObjectFlags = ((1, "hHandle"),
- (1, "dwMilliseconds", -1))
-WaitForSingleObject = WaitForSingleObjectProto(
- ("WaitForSingleObject", windll.kernel32),
- WaitForSingleObjectFlags)
-
-INFINITE = -1
-WAIT_TIMEOUT = 0x0102
-WAIT_OBJECT_0 = 0x0
-WAIT_ABANDONED = 0x0080
-WAIT_FAILED = 0xFFFFFFFF
-
-# GetExitCodeProcess()
-
-GetExitCodeProcessProto = WINFUNCTYPE(BOOL, # Return type
- HANDLE, # hProcess
- LPDWORD, # lpExitCode
- )
-GetExitCodeProcessFlags = ((1, "hProcess"),
- (2, "lpExitCode"))
-GetExitCodeProcess = GetExitCodeProcessProto(
- ("GetExitCodeProcess", windll.kernel32),
- GetExitCodeProcessFlags)
-GetExitCodeProcess.errcheck = ErrCheckBool
-
-def CanCreateJobObject():
- currentProc = GetCurrentProcess()
- if IsProcessInJob(currentProc):
- jobinfo = QueryInformationJobObject(HANDLE(0), 'JobObjectExtendedLimitInformation')
- limitflags = jobinfo['BasicLimitInformation']['LimitFlags']
- return bool(limitflags & JOB_OBJECT_LIMIT_BREAKAWAY_OK) or bool(limitflags & JOB_OBJECT_LIMIT_SILENT_BREAKAWAY_OK)
- else:
- return True
-
-### testing functions
-
-def parent():
- print 'Starting parent'
- currentProc = GetCurrentProcess()
- if IsProcessInJob(currentProc):
- print >> sys.stderr, "You should not be in a job object to test"
- sys.exit(1)
- assert CanCreateJobObject()
- print 'File: %s' % __file__
- command = [sys.executable, __file__, '-child']
- print 'Running command: %s' % command
- process = Popen(command)
- process.kill()
- code = process.returncode
- print 'Child code: %s' % code
- assert code == 127
-
-def child():
- print 'Starting child'
- currentProc = GetCurrentProcess()
- injob = IsProcessInJob(currentProc)
- print "Is in a job?: %s" % injob
- can_create = CanCreateJobObject()
- print 'Can create job?: %s' % can_create
- process = Popen('c:\\windows\\notepad.exe')
- assert process._job
- jobinfo = QueryInformationJobObject(process._job, 'JobObjectExtendedLimitInformation')
- print 'Job info: %s' % jobinfo
- limitflags = jobinfo['BasicLimitInformation']['LimitFlags']
- print 'LimitFlags: %s' % limitflags
- process.kill()
-
-if __name__ == '__main__':
- import sys
- from killableprocess import Popen
- nargs = len(sys.argv[1:])
- if nargs:
- if nargs != 1 or sys.argv[1] != '-child':
- raise AssertionError('Wrong flags; run like `python /path/to/winprocess.py`')
- child()
- else:
- parent()
deleted file mode 100644
--- a/mail/test/resources/mozrunner/mozrunner/wpk.py
+++ /dev/null
@@ -1,76 +0,0 @@
-from ctypes import sizeof, windll, addressof, c_wchar, create_unicode_buffer
-from ctypes.wintypes import DWORD, HANDLE
-
-PROCESS_TERMINATE = 0x0001
-PROCESS_QUERY_INFORMATION = 0x0400
-PROCESS_VM_READ = 0x0010
-
-def get_pids(process_name):
- BIG_ARRAY = DWORD * 4096
- processes = BIG_ARRAY()
- needed = DWORD()
-
- pids = []
- result = windll.psapi.EnumProcesses(processes,
- sizeof(processes),
- addressof(needed))
- if not result:
- return pids
-
- num_results = needed.value / sizeof(DWORD)
-
- for i in range(num_results):
- pid = processes[i]
- process = windll.kernel32.OpenProcess(PROCESS_QUERY_INFORMATION |
- PROCESS_VM_READ,
- 0, pid)
- if process:
- module = HANDLE()
- result = windll.psapi.EnumProcessModules(process,
- addressof(module),
- sizeof(module),
- addressof(needed))
- if result:
- name = create_unicode_buffer(1024)
- result = windll.psapi.GetModuleBaseNameW(process, module,
- name, len(name))
- # TODO: This might not be the best way to
- # match a process name; maybe use a regexp instead.
- if name.value.startswith(process_name):
- pids.append(pid)
- windll.kernel32.CloseHandle(module)
- windll.kernel32.CloseHandle(process)
-
- return pids
-
-def kill_pid(pid):
- process = windll.kernel32.OpenProcess(PROCESS_TERMINATE, 0, pid)
- if process:
- windll.kernel32.TerminateProcess(process, 0)
- windll.kernel32.CloseHandle(process)
-
-if __name__ == '__main__':
- import subprocess
- import time
-
- # This test just opens a new notepad instance and kills it.
-
- name = 'notepad'
-
- old_pids = set(get_pids(name))
- subprocess.Popen([name])
- time.sleep(0.25)
- new_pids = set(get_pids(name)).difference(old_pids)
-
- if len(new_pids) != 1:
- raise Exception('%s was not opened or get_pids() is '
- 'malfunctioning' % name)
-
- kill_pid(tuple(new_pids)[0])
-
- newest_pids = set(get_pids(name)).difference(old_pids)
-
- if len(newest_pids) != 0:
- raise Exception('kill_pid() is malfunctioning')
-
- print "Test passed."
deleted file mode 100644
--- a/mail/test/resources/mozrunner/setup.py
+++ /dev/null
@@ -1,79 +0,0 @@
-# ***** BEGIN LICENSE BLOCK *****
-# Version: MPL 1.1/GPL 2.0/LGPL 2.1
-#
-# The contents of this file are subject to the Mozilla Public License Version
-# 1.1 (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-# http://www.mozilla.org/MPL/
-#
-# Software distributed under the License is distributed on an "AS IS" basis,
-# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-# for the specific language governing rights and limitations under the
-# License.
-#
-# The Original Code is Mozilla Corporation Code.
-#
-# The Initial Developer of the Original Code is
-# Mikeal Rogers.
-# Portions created by the Initial Developer are Copyright (C) 2008
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-# Mikeal Rogers <mikeal.rogers@gmail.com>
-#
-# Alternatively, the contents of this file may be used under the terms of
-# either the GNU General Public License Version 2 or later (the "GPL"), or
-# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-# in which case the provisions of the GPL or the LGPL are applicable instead
-# of those above. If you wish to allow use of your version of this file only
-# under the terms of either the GPL or the LGPL, and not to allow others to
-# use your version of this file under the terms of the MPL, indicate your
-# decision by deleting the provisions above and replace them with the notice
-# and other provisions required by the GPL or the LGPL. If you do not delete
-# the provisions above, a recipient may use your version of this file under
-# the terms of any one of the MPL, the GPL or the LGPL.
-#
-# ***** END LICENSE BLOCK *****
-
-from setuptools import setup, find_packages
-import sys
-
-desc = """Reliable start/stop/configuration of Mozilla Applications (Firefox, Thunderbird, etc.)"""
-
-PACKAGE_NAME = "mozrunner"
-PACKAGE_VERSION = "2.5.5b4"
-
-deps = []
-
-# we only support python 2 right now
-assert sys.version_info[0] == 2
-
-# version-dependent dependencies
-if sys.version_info[1] < 6:
- deps.append('simplejson')
-
-setup(name=PACKAGE_NAME,
- version=PACKAGE_VERSION,
- description=desc,
- long_description=desc,
- author='Mikeal Rogers, Mozilla',
- author_email='mikeal.rogers@gmail.com',
- url='http://github.com/mozautomation/mozmill',
- license='MPL 1.1/GPL 2.0/LGPL 2.1',
- packages=find_packages(exclude=['legacy']),
- zip_safe=False,
- entry_points="""
- [console_scripts]
- mozrunner = mozrunner:cli
- addon_id = mozrunner:print_addon_ids
- """,
- platforms =['Any'],
- install_requires = deps,
- classifiers=['Development Status :: 4 - Beta',
- 'Environment :: Console',
- 'Intended Audience :: Developers',
- 'License :: OSI Approved :: Mozilla Public License 1.1 (MPL 1.1)',
- 'Operating System :: OS Independent',
- 'Topic :: Software Development :: Libraries :: Python Modules',
- ]
- )
deleted file mode 100644
--- a/mail/test/resources/mozrunner/tests/debub_settings.py
+++ /dev/null
@@ -1,4 +0,0 @@
-
-MOZILLA_CMD_ARGS = ['-jsconsole']
-
-MOZILLA_CREATE_NEW_PROFILE = True
\ No newline at end of file
deleted file mode 100644
--- a/mail/test/resources/mozrunner/tests/jss_settings.py
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-MOZILLA_PLUGINS = ['/Users/mikeal/Desktop/jssh-firefox-3.x.xpi']
-
-MOZILLA_CMD_ARGS = ['-jssh', '-jsconsole']
-
-MOZILLA_CREATE_NEW_PROFILE = True
deleted file mode 100644
--- a/mail/test/resources/simplejson-2.1.6/.gitignore
+++ /dev/null
@@ -1,6 +0,0 @@
-*.egg-info
-*.egg
-*.pyc
-*.so
-/build
-/dist
deleted file mode 100644
--- a/mail/test/resources/simplejson-2.1.6/.gitmodules
+++ /dev/null
@@ -1,3 +0,0 @@
-[submodule "docs"]
- path = docs
- url = git@github.com:simplejson/simplejson.git
deleted file mode 100644
--- a/mail/test/resources/simplejson-2.1.6/CHANGES.txt
+++ /dev/null
@@ -1,218 +0,0 @@
-Version 2.1.6 released 2011-05-08
-
-* Prevent segfaults with deeply nested JSON documents
- https://github.com/simplejson/simplejson/issues/11
-* Fix compatibility with Python 2.5
- https://github.com/simplejson/simplejson/issues/5
-
-Version 2.1.5 released 2011-04-17
-
-* Built sdist tarball with setuptools_git installed. Argh.
-
-Version 2.1.4 released 2011-04-17
-
-* Does not try to build the extension when using PyPy
-* Trailing whitespace after commas no longer emitted when indent is used
-* Migrated to github http://github.com/simplejson/simplejson
-
-Version 2.1.3 released 2011-01-17
-
-* Support the sort_keys option in C encoding speedups
- http://code.google.com/p/simplejson/issues/detail?id=86
-* Allow use_decimal to work with dump()
- http://code.google.com/p/simplejson/issues/detail?id=87
-
-Version 2.1.2 released 2010-11-01
-
-* Correct wrong end when object_pairs_hook is used
- http://code.google.com/p/simplejson/issues/detail?id=85
-* Correct output for indent=0
- http://bugs.python.org/issue10019
-* Correctly raise TypeError when non-string keys are used with speedups
- http://code.google.com/p/simplejson/issues/detail?id=82
-* Fix the endlineno, endcolno attributes of the JSONDecodeError exception.
- http://code.google.com/p/simplejson/issues/detail?id=81
-
-Version 2.1.1 released 2010-03-31
-
-* Change how setup.py imports ez_setup.py to try and workaround old versions
- of setuptools.
- http://code.google.com/p/simplejson/issues/detail?id=75
-* Fix compilation on Windows platform (and other platforms with very
- picky compilers)
-* Corrected simplejson.__version__ and other minor doc changes.
-* Do not fail speedups tests if speedups could not be built.
- http://code.google.com/p/simplejson/issues/detail?id=73
-
-Version 2.1.0 released 2010-03-10
-
-* Decimal serialization officially supported for encoding with
- use_decimal=True. For encoding this encodes Decimal objects and
- for decoding it implies parse_float=Decimal
-* Python 2.4 no longer supported (may still work, but no longer tested)
-* Decoding performance and memory utilization enhancements
- http://bugs.python.org/issue7451
-* JSONEncoderForHTML class for escaping &, <, >
- http://code.google.com/p/simplejson/issues/detail?id=66
-* Memoization of object keys during encoding (when using speedups)
-* Encoder changed to use PyIter_Next for list iteration to avoid
- potential threading issues
-* Encoder changed to use iteritems rather than PyDict_Next in order to
- support dict subclasses that have a well defined ordering
- http://bugs.python.org/issue6105
-* indent encoding parameter changed to be a string rather than an integer
- (integer use still supported for backwards compatibility)
- http://code.google.com/p/simplejson/issues/detail?id=56
-* Test suite (python setup.py test) now automatically runs with and without
- speedups
- http://code.google.com/p/simplejson/issues/detail?id=55
-* Fixed support for older versions of easy_install (e.g. stock Mac OS X config)
- http://code.google.com/p/simplejson/issues/detail?id=54
-* Fixed str/unicode mismatches when using ensure_ascii=False
- http://code.google.com/p/simplejson/issues/detail?id=48
-* Fixed error message when parsing an array with trailing comma with speedups
- http://code.google.com/p/simplejson/issues/detail?id=46
-* Refactor decoder errors to raise JSONDecodeError instead of ValueError
- http://code.google.com/p/simplejson/issues/detail?id=45
-* New ordered_pairs_hook feature in decoder which makes it possible to
- preserve key order. http://bugs.python.org/issue5381
-* Fixed containerless unicode float decoding (same bug as 2.0.4, oops!)
- http://code.google.com/p/simplejson/issues/detail?id=43
-* Share PosInf definition between encoder and decoder
-* Minor reformatting to make it easier to backport simplejson changes
- to Python 2.7/3.1 json module
-
-Version 2.0.9 released 2009-02-18
-
-* Adds cyclic GC to the Encoder and Scanner speedups, which could've
- caused uncollectible cycles in some cases when using custom parser
- or encoder functions
-
-Version 2.0.8 released 2009-02-15
-
-* Documentation fixes
-* Fixes encoding True and False as keys
-* Fixes checking for True and False by identity for several parameters
-
-Version 2.0.7 released 2009-01-04
-
-* Documentation fixes
-* C extension now always returns unicode strings when the input string is
- unicode, even for empty strings
-
-Version 2.0.6 released 2008-12-19
-
-* Windows build fixes
-
-Version 2.0.5 released 2008-11-23
-
-* Fixes a segfault in the C extension when using check_circular=False and
- encoding an invalid document
-
-Version 2.0.4 released 2008-10-24
-
-* Fixes a parsing error in the C extension when the JSON document is (only)
- a floating point number. It would consume one too few characters in that
- case, and claim the document invalid.
-
-Version 2.0.3 released 2008-10-11
-
-* Fixes reference leaks in the encoding speedups (sorry about that!)
-* Fixes doctest suite for Python 2.6
-* More optimizations for the decoder
-
-Version 2.0.2 released 2008-10-06
-
-* Fixes MSVC2003 build regression
-* Fixes Python 2.4 compatibility in _speedups.c
-
-Version 2.0.1 released 2008-09-29
-
-* Fixes long encoding regression introduced in 2.0.0
-* Fixes MinGW build regression introduced in 2.0.0
-
-Version 2.0.0 released 2008-09-27
-
-* optimized Python encoding path
-* optimized Python decoding path
-* optimized C encoding path
-* optimized C decoding path
-* switched to sphinx docs (nearly the same as the json module in python 2.6)
-
-Version 1.9.3 released 2008-09-23
-
-* Decoding is significantly faster (for our internal benchmarks)
-* Pretty-printing tool changed from simplejson to simplejson.tool for better
- Python 2.6 comaptibility
-* Misc. bug fixes
-
-Version 1.9 released 2008-05-03
-
-* Rewrote test suite with unittest and doctest (no more nosetest dependency)
-* Better PEP 7 and PEP 8 source compliance
-* Removed simplejson.jsonfilter demo module
-* simplejson.jsonfilter is no longer included
-
-Version 1.8.1 released 2008-03-24
-
-* Optional C extension for accelerating the decoding of JSON strings
-* Command line interface for pretty-printing JSON (via python -msimplejson)
-* Decoding of integers and floats is now extensible (e.g. to use Decimal) via
- parse_int, parse_float options.
-* Subversion and issue tracker moved to google code:
- http://code.google.com/p/simplejson/
-* "/" is no longer escaped, so if you're embedding JSON directly in HTML
- you'll want to use .replace("/", "\\/") to prevent a close-tag attack.
-
-Version 1.7 released 2007-03-18
-
-* Improves encoding performance with an optional C extension to speed up
- str/unicode encoding (by 10-150x or so), which yields an overall speed
- boost of 2x+ (JSON is string-heavy).
-* Support for encoding unicode code points outside the BMP to UTF-16
- surrogate code pairs (specified by the Strings section of RFC 4627).
-
-Version 1.6 released 2007-03-03
-
-* Improved str support for encoding. Previous versions of simplejson
- integrated strings directly into the output stream, this version ensures
- they're of a particular encoding (default is UTF-8) so that the output
- stream is valid.
-
-Version 1.5 released 2007-01-18
-
-* Better Python 2.5 compatibility
-* Better Windows compatibility
-* indent encoding parameter for pretty printing
-* separators encoding parameter for generating optimally compact JSON
-
-Version 1.3 released 2006-04-01
-
-* The optional object_hook function is called upon decoding of any JSON
- object literal, and its return value is used instead of the dict that
- would normally be used. This can be used to efficiently implement
- features such as JSON-RPC class hinting, or other custom decodings of
- JSON. See the documentation for more information.
-
-Version 1.1 released 2005-12-31
-
-* Renamed from simple_json to simplejson to comply with PEP 8 module naming
- guidelines
-* Full set of documentation
-* More tests
-* The encoder and decoder have been extended to understand NaN, Infinity, and
- -Infinity (but this can be turned off via allow_nan=False for strict JSON
- compliance)
-* The decoder's scanner has been fixed so that it no longer accepts invalid
- JSON documents
-* The decoder now reports line and column information as well as character
- numbers for easier debugging
-* The encoder now has a circular reference checker, which can be optionally
- disabled with check_circular=False
-* dump, dumps, load, loads now accept an optional cls kwarg to use an
- alternate JSONEncoder or JSONDecoder class for convenience.
-* The read/write compatibility shim for json-py now have deprecation warnings
-
-Version 1.0 released 2005-12-25
-
- * Initial release
deleted file mode 100644
--- a/mail/test/resources/simplejson-2.1.6/LICENSE.txt
+++ /dev/null
@@ -1,19 +0,0 @@
-Copyright (c) 2006 Bob Ippolito
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal in
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-of the Software, and to permit persons to whom the Software is furnished to do
-so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
deleted file mode 100644
--- a/mail/test/resources/simplejson-2.1.6/PKG-INFO
+++ /dev/null
@@ -1,33 +0,0 @@
-Metadata-Version: 1.0
-Name: simplejson
-Version: 2.1.6
-Summary: Simple, fast, extensible JSON encoder/decoder for Python
-Home-page: http://github.com/simplejson/simplejson
-Author: Bob Ippolito
-Author-email: bob@redivi.com
-License: MIT License
-Description: simplejson is a simple, fast, complete, correct and extensible
- JSON <http://json.org> encoder and decoder for Python 2.5+. It is
- pure Python code with no dependencies, but includes an optional C
- extension for a serious speed boost.
-
- The latest documentation for simplejson can be read online here:
- http://simplejson.github.com/simplejson/
-
- simplejson is the externally maintained development version of the
- json library included with Python 2.6 and Python 3.0, but maintains
- backwards compatibility with Python 2.5.
-
- The encoder may be subclassed to provide serialization in any kind of
- situation, without any special support by the objects to be serialized
- (somewhat like pickle).
-
- The decoder can handle incoming JSON strings of any specified encoding
- (UTF-8 by default).
-
-
-Platform: any
-Classifier: Intended Audience :: Developers
-Classifier: License :: OSI Approved :: MIT License
-Classifier: Programming Language :: Python
-Classifier: Topic :: Software Development :: Libraries :: Python Modules
deleted file mode 100644
--- a/mail/test/resources/simplejson-2.1.6/README.rst
+++ /dev/null
@@ -1,19 +0,0 @@
-simplejson is a simple, fast, complete, correct and extensible
-JSON <http://json.org> encoder and decoder for Python 2.5+. It is
-pure Python code with no dependencies, but includes an optional C
-extension for a serious speed boost.
-
-The latest documentation for simplejson can be read online here:
-http://simplejson.github.com/simplejson/
-
-simplejson is the externally maintained development version of the
-json library included with Python 2.6 and Python 3.0, but maintains
-backwards compatibility with Python 2.5.
-
-The encoder may be subclassed to provide serialization in any kind of
-situation, without any special support by the objects to be serialized
-(somewhat like pickle).
-
-The decoder can handle incoming JSON strings of any specified encoding
-(UTF-8 by default).
-
deleted file mode 100644
--- a/mail/test/resources/simplejson-2.1.6/conf.py
+++ /dev/null
@@ -1,179 +0,0 @@
-# -*- coding: utf-8 -*-
-#
-# simplejson documentation build configuration file, created by
-# sphinx-quickstart on Fri Sep 26 18:58:30 2008.
-#
-# This file is execfile()d with the current directory set to its containing dir.
-#
-# The contents of this file are pickled, so don't put values in the namespace
-# that aren't pickleable (module imports are okay, they're removed automatically).
-#
-# All configuration values have a default value; values that are commented out
-# serve to show the default value.
-
-import sys, os
-
-# If your extensions are in another directory, add it here. If the directory
-# is relative to the documentation root, use os.path.abspath to make it
-# absolute, like shown here.
-#sys.path.append(os.path.abspath('some/directory'))
-
-# General configuration
-# ---------------------
-
-# Add any Sphinx extension module names here, as strings. They can be extensions
-# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
-extensions = []
-
-# Add any paths that contain templates here, relative to this directory.
-templates_path = ['_templates']
-
-# The suffix of source filenames.
-source_suffix = '.rst'
-
-# The master toctree document.
-master_doc = 'index'
-
-# General substitutions.
-project = 'simplejson'
-copyright = '2011, Bob Ippolito'
-
-# The default replacements for |version| and |release|, also used in various
-# other places throughout the built documents.
-#
-# The short X.Y version.
-version = '2.1'
-# The full version, including alpha/beta/rc tags.
-release = '2.1.6'
-
-# There are two options for replacing |today|: either, you set today to some
-# non-false value, then it is used:
-#today = ''
-# Else, today_fmt is used as the format for a strftime call.
-today_fmt = '%B %d, %Y'
-
-# List of documents that shouldn't be included in the build.
-#unused_docs = []
-
-# List of directories, relative to source directories, that shouldn't be searched
-# for source files.
-#exclude_dirs = []
-
-# The reST default role (used for this markup: `text`) to use for all documents.
-#default_role = None
-
-# If true, '()' will be appended to :func: etc. cross-reference text.
-#add_function_parentheses = True
-
-# If true, the current module name will be prepended to all description
-# unit titles (such as .. function::).
-#add_module_names = True
-
-# If true, sectionauthor and moduleauthor directives will be shown in the
-# output. They are ignored by default.
-#show_authors = False
-
-# The name of the Pygments (syntax highlighting) style to use.
-pygments_style = 'sphinx'
-
-
-# Options for HTML output
-# -----------------------
-
-# The style sheet to use for HTML and HTML Help pages. A file of that name
-# must exist either in Sphinx' static/ path, or in one of the custom paths
-# given in html_static_path.
-html_style = 'default.css'
-
-# The name for this set of Sphinx documents. If None, it defaults to
-# "<project> v<release> documentation".
-#html_title = None
-
-# A shorter title for the navigation bar. Default is the same as html_title.
-#html_short_title = None
-
-# The name of an image file (within the static path) to place at the top of
-# the sidebar.
-#html_logo = None
-
-# The name of an image file (within the static path) to use as favicon of the
-# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
-# pixels large.
-#html_favicon = None
-
-# Add any paths that contain custom static files (such as style sheets) here,
-# relative to this directory. They are copied after the builtin static files,
-# so a file named "default.css" will overwrite the builtin "default.css".
-html_static_path = ['_static']
-
-# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
-# using the given strftime format.
-html_last_updated_fmt = '%b %d, %Y'
-
-# If true, SmartyPants will be used to convert quotes and dashes to
-# typographically correct entities.
-#html_use_smartypants = True
-
-# Custom sidebar templates, maps document names to template names.
-#html_sidebars = {}
-
-# Additional templates that should be rendered to pages, maps page names to
-# template names.
-#html_additional_pages = {}
-
-# If false, no module index is generated.
-html_use_modindex = False
-
-# If false, no index is generated.
-#html_use_index = True
-
-# If true, the index is split into individual pages for each letter.
-#html_split_index = False
-
-# If true, the reST sources are included in the HTML build as _sources/<name>.
-#html_copy_source = True
-
-# If true, an OpenSearch description file will be output, and all pages will
-# contain a <link> tag referring to it. The value of this option must be the
-# base URL from which the finished HTML is served.
-#html_use_opensearch = ''
-
-# If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml").
-html_file_suffix = '.html'
-
-# Output file base name for HTML help builder.
-htmlhelp_basename = 'simplejsondoc'
-
-
-# Options for LaTeX output
-# ------------------------
-
-# The paper size ('letter' or 'a4').
-#latex_paper_size = 'letter'
-
-# The font size ('10pt', '11pt' or '12pt').
-#latex_font_size = '10pt'
-
-# Grouping the document tree into LaTeX files. List of tuples
-# (source start file, target name, title, author, document class [howto/manual]).
-latex_documents = [
- ('index', 'simplejson.tex', 'simplejson Documentation',
- 'Bob Ippolito', 'manual'),
-]
-
-# The name of an image file (relative to this directory) to place at the top of
-# the title page.
-#latex_logo = None
-
-# For "manual" documents, if this is true, then toplevel headings are parts,
-# not chapters.
-#latex_use_parts = False
-
-# Additional stuff for the LaTeX preamble.
-#latex_preamble = ''
-
-# Documents to append as an appendix to all manuals.
-#latex_appendices = []
-
-# If false, no module index is generated.
-#latex_use_modindex = True
deleted file mode 100644
--- a/mail/test/resources/simplejson-2.1.6/ez_setup.py
+++ /dev/null
@@ -1,284 +0,0 @@
-#!python
-"""Bootstrap setuptools installation
-
-If you want to use setuptools in your package's setup.py, just include this
-file in the same directory with it, and add this to the top of your setup.py::
-
- from ez_setup import use_setuptools
- use_setuptools()
-
-If you want to require a specific version of setuptools, set a download
-mirror, or use an alternate download directory, you can do so by supplying
-the appropriate options to ``use_setuptools()``.
-
-This file can also be run as a script to install or upgrade setuptools.
-"""
-import sys
-DEFAULT_VERSION = "0.6c11"
-DEFAULT_URL = "http://pypi.python.org/packages/%s/s/setuptools/" % sys.version[:3]
-
-md5_data = {
- 'setuptools-0.6b1-py2.3.egg': '8822caf901250d848b996b7f25c6e6ca',
- 'setuptools-0.6b1-py2.4.egg': 'b79a8a403e4502fbb85ee3f1941735cb',
- 'setuptools-0.6b2-py2.3.egg': '5657759d8a6d8fc44070a9d07272d99b',
- 'setuptools-0.6b2-py2.4.egg': '4996a8d169d2be661fa32a6e52e4f82a',
- 'setuptools-0.6b3-py2.3.egg': 'bb31c0fc7399a63579975cad9f5a0618',
- 'setuptools-0.6b3-py2.4.egg': '38a8c6b3d6ecd22247f179f7da669fac',
- 'setuptools-0.6b4-py2.3.egg': '62045a24ed4e1ebc77fe039aa4e6f7e5',
- 'setuptools-0.6b4-py2.4.egg': '4cb2a185d228dacffb2d17f103b3b1c4',
- 'setuptools-0.6c1-py2.3.egg': 'b3f2b5539d65cb7f74ad79127f1a908c',
- 'setuptools-0.6c1-py2.4.egg': 'b45adeda0667d2d2ffe14009364f2a4b',
- 'setuptools-0.6c10-py2.3.egg': 'ce1e2ab5d3a0256456d9fc13800a7090',
- 'setuptools-0.6c10-py2.4.egg': '57d6d9d6e9b80772c59a53a8433a5dd4',
- 'setuptools-0.6c10-py2.5.egg': 'de46ac8b1c97c895572e5e8596aeb8c7',
- 'setuptools-0.6c10-py2.6.egg': '58ea40aef06da02ce641495523a0b7f5',
- 'setuptools-0.6c11-py2.3.egg': '2baeac6e13d414a9d28e7ba5b5a596de',
- 'setuptools-0.6c11-py2.4.egg': 'bd639f9b0eac4c42497034dec2ec0c2b',
- 'setuptools-0.6c11-py2.5.egg': '64c94f3bf7a72a13ec83e0b24f2749b2',
- 'setuptools-0.6c11-py2.6.egg': 'bfa92100bd772d5a213eedd356d64086',
- 'setuptools-0.6c2-py2.3.egg': 'f0064bf6aa2b7d0f3ba0b43f20817c27',
- 'setuptools-0.6c2-py2.4.egg': '616192eec35f47e8ea16cd6a122b7277',
- 'setuptools-0.6c3-py2.3.egg': 'f181fa125dfe85a259c9cd6f1d7b78fa',
- 'setuptools-0.6c3-py2.4.egg': 'e0ed74682c998bfb73bf803a50e7b71e',
- 'setuptools-0.6c3-py2.5.egg': 'abef16fdd61955514841c7c6bd98965e',
- 'setuptools-0.6c4-py2.3.egg': 'b0b9131acab32022bfac7f44c5d7971f',
- 'setuptools-0.6c4-py2.4.egg': '2a1f9656d4fbf3c97bf946c0a124e6e2',
- 'setuptools-0.6c4-py2.5.egg': '8f5a052e32cdb9c72bcf4b5526f28afc',
- 'setuptools-0.6c5-py2.3.egg': 'ee9fd80965da04f2f3e6b3576e9d8167',
- 'setuptools-0.6c5-py2.4.egg': 'afe2adf1c01701ee841761f5bcd8aa64',
- 'setuptools-0.6c5-py2.5.egg': 'a8d3f61494ccaa8714dfed37bccd3d5d',
- 'setuptools-0.6c6-py2.3.egg': '35686b78116a668847237b69d549ec20',
- 'setuptools-0.6c6-py2.4.egg': '3c56af57be3225019260a644430065ab',
- 'setuptools-0.6c6-py2.5.egg': 'b2f8a7520709a5b34f80946de5f02f53',
- 'setuptools-0.6c7-py2.3.egg': '209fdf9adc3a615e5115b725658e13e2',
- 'setuptools-0.6c7-py2.4.egg': '5a8f954807d46a0fb67cf1f26c55a82e',
- 'setuptools-0.6c7-py2.5.egg': '45d2ad28f9750e7434111fde831e8372',
- 'setuptools-0.6c8-py2.3.egg': '50759d29b349db8cfd807ba8303f1902',
- 'setuptools-0.6c8-py2.4.egg': 'cba38d74f7d483c06e9daa6070cce6de',
- 'setuptools-0.6c8-py2.5.egg': '1721747ee329dc150590a58b3e1ac95b',
- 'setuptools-0.6c9-py2.3.egg': 'a83c4020414807b496e4cfbe08507c03',
- 'setuptools-0.6c9-py2.4.egg': '260a2be2e5388d66bdaee06abec6342a',
- 'setuptools-0.6c9-py2.5.egg': 'fe67c3e5a17b12c0e7c541b7ea43a8e6',
- 'setuptools-0.6c9-py2.6.egg': 'ca37b1ff16fa2ede6e19383e7b59245a',
-}
-
-import sys, os
-try: from hashlib import md5
-except ImportError: from md5 import md5
-
-def _validate_md5(egg_name, data):
- if egg_name in md5_data:
- digest = md5(data).hexdigest()
- if digest != md5_data[egg_name]:
- print >>sys.stderr, (
- "md5 validation of %s failed! (Possible download problem?)"
- % egg_name
- )
- sys.exit(2)
- return data
-
-def use_setuptools(
- version=DEFAULT_VERSION, download_base=DEFAULT_URL, to_dir=os.curdir,
- download_delay=15
-):
- """Automatically find/download setuptools and make it available on sys.path
-
- `version` should be a valid setuptools version number that is available
- as an egg for download under the `download_base` URL (which should end with
- a '/'). `to_dir` is the directory where setuptools will be downloaded, if
- it is not already available. If `download_delay` is specified, it should
- be the number of seconds that will be paused before initiating a download,
- should one be required. If an older version of setuptools is installed,
- this routine will print a message to ``sys.stderr`` and raise SystemExit in
- an attempt to abort the calling script.
- """
- was_imported = 'pkg_resources' in sys.modules or 'setuptools' in sys.modules
- def do_download():
- egg = download_setuptools(version, download_base, to_dir, download_delay)
- sys.path.insert(0, egg)
- import setuptools; setuptools.bootstrap_install_from = egg
- try:
- import pkg_resources
- except ImportError:
- return do_download()
- try:
- pkg_resources.require("setuptools>="+version); return
- except pkg_resources.VersionConflict, e:
- if was_imported:
- print >>sys.stderr, (
- "The required version of setuptools (>=%s) is not available, and\n"
- "can't be installed while this script is running. Please install\n"
- " a more recent version first, using 'easy_install -U setuptools'."
- "\n\n(Currently using %r)"
- ) % (version, e.args[0])
- sys.exit(2)
- else:
- del pkg_resources, sys.modules['pkg_resources'] # reload ok
- return do_download()
- except pkg_resources.DistributionNotFound:
- return do_download()
-
-def download_setuptools(
- version=DEFAULT_VERSION, download_base=DEFAULT_URL, to_dir=os.curdir,
- delay = 15
-):
- """Download setuptools from a specified location and return its filename
-
- `version` should be a valid setuptools version number that is available
- as an egg for download under the `download_base` URL (which should end
- with a '/'). `to_dir` is the directory where the egg will be downloaded.
- `delay` is the number of seconds to pause before an actual download attempt.
- """
- import urllib2, shutil
- egg_name = "setuptools-%s-py%s.egg" % (version,sys.version[:3])
- url = download_base + egg_name
- saveto = os.path.join(to_dir, egg_name)
- src = dst = None
- if not os.path.exists(saveto): # Avoid repeated downloads
- try:
- from distutils import log
- if delay:
- log.warn("""
----------------------------------------------------------------------------
-This script requires setuptools version %s to run (even to display
-help). I will attempt to download it for you (from
-%s), but
-you may need to enable firewall access for this script first.
-I will start the download in %d seconds.
-
-(Note: if this machine does not have network access, please obtain the file
-
- %s
-
-and place it in this directory before rerunning this script.)
----------------------------------------------------------------------------""",
- version, download_base, delay, url
- ); from time import sleep; sleep(delay)
- log.warn("Downloading %s", url)
- src = urllib2.urlopen(url)
- # Read/write all in one block, so we don't create a corrupt file
- # if the download is interrupted.
- data = _validate_md5(egg_name, src.read())
- dst = open(saveto,"wb"); dst.write(data)
- finally:
- if src: src.close()
- if dst: dst.close()
- return os.path.realpath(saveto)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-def main(argv, version=DEFAULT_VERSION):
- """Install or upgrade setuptools and EasyInstall"""
- try:
- import setuptools
- except ImportError:
- egg = None
- try:
- egg = download_setuptools(version, delay=0)
- sys.path.insert(0,egg)
- from setuptools.command.easy_install import main
- return main(list(argv)+[egg]) # we're done here
- finally:
- if egg and os.path.exists(egg):
- os.unlink(egg)
- else:
- if setuptools.__version__ == '0.0.1':
- print >>sys.stderr, (
- "You have an obsolete version of setuptools installed. Please\n"
- "remove it from your system entirely before rerunning this script."
- )
- sys.exit(2)
-
- req = "setuptools>="+version
- import pkg_resources
- try:
- pkg_resources.require(req)
- except pkg_resources.VersionConflict:
- try:
- from setuptools.command.easy_install import main
- except ImportError:
- from easy_install import main
- main(list(argv)+[download_setuptools(delay=0)])
- sys.exit(0) # try to force an exit
- else:
- if argv:
- from setuptools.command.easy_install import main
- main(argv)
- else:
- print "Setuptools version",version,"or greater has been installed."
- print '(Run "ez_setup.py -U setuptools" to reinstall or upgrade.)'
-
-def update_md5(filenames):
- """Update our built-in md5 registry"""
-
- import re
-
- for name in filenames:
- base = os.path.basename(name)
- f = open(name,'rb')
- md5_data[base] = md5(f.read()).hexdigest()
- f.close()
-
- data = [" %r: %r,\n" % it for it in md5_data.items()]
- data.sort()
- repl = "".join(data)
-
- import inspect
- srcfile = inspect.getsourcefile(sys.modules[__name__])
- f = open(srcfile, 'rb'); src = f.read(); f.close()
-
- match = re.search("\nmd5_data = {\n([^}]+)}", src)
- if not match:
- print >>sys.stderr, "Internal error!"
- sys.exit(2)
-
- src = src[:match.start(1)] + repl + src[match.end(1):]
- f = open(srcfile,'w')
- f.write(src)
- f.close()
-
-
-if __name__=='__main__':
- if len(sys.argv)>2 and sys.argv[1]=='--md5update':
- update_md5(sys.argv[2:])
- else:
- main(sys.argv[1:])
-
-
-
-
-
-
deleted file mode 100644
--- a/mail/test/resources/simplejson-2.1.6/index.rst
+++ /dev/null
@@ -1,506 +0,0 @@
-:mod:`simplejson` --- JSON encoder and decoder
-==============================================
-
-.. module:: simplejson
- :synopsis: Encode and decode the JSON format.
-.. moduleauthor:: Bob Ippolito <bob@redivi.com>
-.. sectionauthor:: Bob Ippolito <bob@redivi.com>
-
-JSON (JavaScript Object Notation) <http://json.org> is a subset of JavaScript
-syntax (ECMA-262 3rd edition) used as a lightweight data interchange format.
-
-:mod:`simplejson` exposes an API familiar to users of the standard library
-:mod:`marshal` and :mod:`pickle` modules. It is the externally maintained
-version of the :mod:`json` library contained in Python 2.6, but maintains
-compatibility with Python 2.5 and (currently) has
-significant performance advantages, even without using the optional C
-extension for speedups.
-
-Development of simplejson happens on Github:
-http://github.com/simplejson/simplejson
-
-Encoding basic Python object hierarchies::
-
- >>> import simplejson as json
- >>> json.dumps(['foo', {'bar': ('baz', None, 1.0, 2)}])
- '["foo", {"bar": ["baz", null, 1.0, 2]}]'
- >>> print json.dumps("\"foo\bar")
- "\"foo\bar"
- >>> print json.dumps(u'\u1234')
- "\u1234"
- >>> print json.dumps('\\')
- "\\"
- >>> print json.dumps({"c": 0, "b": 0, "a": 0}, sort_keys=True)
- {"a": 0, "b": 0, "c": 0}
- >>> from StringIO import StringIO
- >>> io = StringIO()
- >>> json.dump(['streaming API'], io)
- >>> io.getvalue()
- '["streaming API"]'
-
-Compact encoding::
-
- >>> import simplejson as json
- >>> json.dumps([1,2,3,{'4': 5, '6': 7}], separators=(',',':'))
- '[1,2,3,{"4":5,"6":7}]'
-
-Pretty printing::
-
- >>> import simplejson as json
- >>> s = json.dumps({'4': 5, '6': 7}, sort_keys=True, indent=4 * ' ')
- >>> print '\n'.join([l.rstrip() for l in s.splitlines()])
- {
- "4": 5,
- "6": 7
- }
-
-Decoding JSON::
-
- >>> import simplejson as json
- >>> obj = [u'foo', {u'bar': [u'baz', None, 1.0, 2]}]
- >>> json.loads('["foo", {"bar":["baz", null, 1.0, 2]}]') == obj
- True
- >>> json.loads('"\\"foo\\bar"') == u'"foo\x08ar'
- True
- >>> from StringIO import StringIO
- >>> io = StringIO('["streaming API"]')
- >>> json.load(io)[0] == 'streaming API'
- True
-
-Using Decimal instead of float::
-
- >>> import simplejson as json
- >>> from decimal import Decimal
- >>> json.loads('1.1', use_decimal=True) == Decimal('1.1')
- True
- >>> json.dumps(Decimal('1.1'), use_decimal=True) == '1.1'
- True
-
-Specializing JSON object decoding::
-
- >>> import simplejson as json
- >>> def as_complex(dct):
- ... if '__complex__' in dct:
- ... return complex(dct['real'], dct['imag'])
- ... return dct
- ...
- >>> json.loads('{"__complex__": true, "real": 1, "imag": 2}',
- ... object_hook=as_complex)
- (1+2j)
- >>> import decimal
- >>> json.loads('1.1', parse_float=decimal.Decimal) == decimal.Decimal('1.1')
- True
-
-Specializing JSON object encoding::
-
- >>> import simplejson as json
- >>> def encode_complex(obj):
- ... if isinstance(obj, complex):
- ... return [obj.real, obj.imag]
- ... raise TypeError(repr(o) + " is not JSON serializable")
- ...
- >>> json.dumps(2 + 1j, default=encode_complex)
- '[2.0, 1.0]'
- >>> json.JSONEncoder(default=encode_complex).encode(2 + 1j)
- '[2.0, 1.0]'
- >>> ''.join(json.JSONEncoder(default=encode_complex).iterencode(2 + 1j))
- '[2.0, 1.0]'
-
-
-.. highlight:: none
-
-Using :mod:`simplejson.tool` from the shell to validate and pretty-print::
-
- $ echo '{"json":"obj"}' | python -m simplejson.tool
- {
- "json": "obj"
- }
- $ echo '{ 1.2:3.4}' | python -m simplejson.tool
- Expecting property name: line 1 column 2 (char 2)
-
-.. highlight:: python
-
-.. note::
-
- The JSON produced by this module's default settings is a subset of
- YAML, so it may be used as a serializer for that as well.
-
-
-Basic Usage
------------
-
-.. function:: dump(obj, fp[, skipkeys[, ensure_ascii[, check_circular[, allow_nan[, cls[, indent[, separators[, encoding[, default[, use_decimal[, **kw]]]]]]]]]]])
-
- Serialize *obj* as a JSON formatted stream to *fp* (a ``.write()``-supporting
- file-like object).
-
- If *skipkeys* is true (default: ``False``), then dict keys that are not
- of a basic type (:class:`str`, :class:`unicode`, :class:`int`, :class:`long`,
- :class:`float`, :class:`bool`, ``None``) will be skipped instead of raising a
- :exc:`TypeError`.
-
- If *ensure_ascii* is false (default: ``True``), then some chunks written
- to *fp* may be :class:`unicode` instances, subject to normal Python
- :class:`str` to :class:`unicode` coercion rules. Unless ``fp.write()``
- explicitly understands :class:`unicode` (as in :func:`codecs.getwriter`) this
- is likely to cause an error. It's best to leave the default settings, because
- they are safe and it is highly optimized.
-
- If *check_circular* is false (default: ``True``), then the circular
- reference check for container types will be skipped and a circular reference
- will result in an :exc:`OverflowError` (or worse).
-
- If *allow_nan* is false (default: ``True``), then it will be a
- :exc:`ValueError` to serialize out of range :class:`float` values (``nan``,
- ``inf``, ``-inf``) in strict compliance of the JSON specification.
- If *allow_nan* is true, their JavaScript equivalents will be used
- (``NaN``, ``Infinity``, ``-Infinity``).
-
- If *indent* is a string, then JSON array elements and object members
- will be pretty-printed with a newline followed by that string repeated
- for each level of nesting. ``None`` (the default) selects the most compact
- representation without any newlines. For backwards compatibility with
- versions of simplejson earlier than 2.1.0, an integer is also accepted
- and is converted to a string with that many spaces.
-
- .. versionchanged:: 2.1.0
- Changed *indent* from an integer number of spaces to a string.
-
- If specified, *separators* should be an ``(item_separator, dict_separator)``
- tuple. By default, ``(', ', ': ')`` are used. To get the most compact JSON
- representation, you should specify ``(',', ':')`` to eliminate whitespace.
-
- *encoding* is the character encoding for str instances, default is
- ``'utf-8'``.
-
- *default(obj)* is a function that should return a serializable version of
- *obj* or raise :exc:`TypeError`. The default simply raises :exc:`TypeError`.
-
- To use a custom :class:`JSONEncoder` subclass (e.g. one that overrides the
- :meth:`default` method to serialize additional types), specify it with the
- *cls* kwarg.
-
- If *use_decimal* is true (default: ``False``) then :class:`decimal.Decimal`
- will be natively serialized to JSON with full precision.
-
- .. versionchanged:: 2.1.0
- *use_decimal* is new in 2.1.0.
-
- .. note::
-
- JSON is not a framed protocol so unlike :mod:`pickle` or :mod:`marshal` it
- does not make sense to serialize more than one JSON document without some
- container protocol to delimit them.
-
-
-.. function:: dumps(obj[, skipkeys[, ensure_ascii[, check_circular[, allow_nan[, cls[, indent[, separators[, encoding[, default[, use_decimal[, **kw]]]]]]]]]]])
-
- Serialize *obj* to a JSON formatted :class:`str`.
-
- If *ensure_ascii* is false, then the return value will be a
- :class:`unicode` instance. The other arguments have the same meaning as in
- :func:`dump`. Note that the default *ensure_ascii* setting has much
- better performance.
-
-
-.. function:: load(fp[, encoding[, cls[, object_hook[, parse_float[, parse_int[, parse_constant[, object_pairs_hook[, use_decimal[, **kw]]]]]]]]])
-
- Deserialize *fp* (a ``.read()``-supporting file-like object containing a JSON
- document) to a Python object.
-
- If the contents of *fp* are encoded with an ASCII based encoding other than
- UTF-8 (e.g. latin-1), then an appropriate *encoding* name must be specified.
- Encodings that are not ASCII based (such as UCS-2) are not allowed, and
- should be wrapped with ``codecs.getreader(fp)(encoding)``, or simply decoded
- to a :class:`unicode` object and passed to :func:`loads`. The default
- setting of ``'utf-8'`` is fastest and should be using whenever possible.
-
- If *fp.read()* returns :class:`str` then decoded JSON strings that contain
- only ASCII characters may be parsed as :class:`str` for performance and
- memory reasons. If your code expects only :class:`unicode` the appropriate
- solution is to wrap fp with a reader as demonstrated above.
-
- *object_hook* is an optional function that will be called with the result of
- any object literal decode (a :class:`dict`). The return value of
- *object_hook* will be used instead of the :class:`dict`. This feature can be used
- to implement custom decoders (e.g. JSON-RPC class hinting).
-
- *object_pairs_hook* is an optional function that will be called with the
- result of any object literal decode with an ordered list of pairs. The
- return value of *object_pairs_hook* will be used instead of the
- :class:`dict`. This feature can be used to implement custom decoders that
- rely on the order that the key and value pairs are decoded (for example,
- :class:`collections.OrderedDict` will remember the order of insertion). If
- *object_hook* is also defined, the *object_pairs_hook* takes priority.
-
- .. versionchanged:: 2.1.0
- Added support for *object_pairs_hook*.
-
- *parse_float*, if specified, will be called with the string of every JSON
- float to be decoded. By default, this is equivalent to ``float(num_str)``.
- This can be used to use another datatype or parser for JSON floats
- (e.g. :class:`decimal.Decimal`).
-
- *parse_int*, if specified, will be called with the string of every JSON int
- to be decoded. By default, this is equivalent to ``int(num_str)``. This can
- be used to use another datatype or parser for JSON integers
- (e.g. :class:`float`).
-
- *parse_constant*, if specified, will be called with one of the following
- strings: ``'-Infinity'``, ``'Infinity'``, ``'NaN'``. This can be used to
- raise an exception if invalid JSON numbers are encountered.
-
- If *use_decimal* is true (default: ``False``) then *parse_float* is set to
- :class:`decimal.Decimal`. This is a convenience for parity with the
- :func:`dump` parameter.
-
- .. versionchanged:: 2.1.0
- *use_decimal* is new in 2.1.0.
-
- To use a custom :class:`JSONDecoder` subclass, specify it with the ``cls``
- kwarg. Additional keyword arguments will be passed to the constructor of the
- class.
-
- .. note::
-
- :func:`load` will read the rest of the file-like object as a string and
- then call :func:`loads`. It does not stop at the end of the first valid
- JSON document it finds and it will raise an error if there is anything
- other than whitespace after the document. Except for files containing
- only one JSON document, it is recommended to use :func:`loads`.
-
-
-.. function:: loads(s[, encoding[, cls[, object_hook[, parse_float[, parse_int[, parse_constant[, object_pairs_hook[, use_decimal[, **kw]]]]]]]]])
-
- Deserialize *s* (a :class:`str` or :class:`unicode` instance containing a JSON
- document) to a Python object.
-
- If *s* is a :class:`str` instance and is encoded with an ASCII based encoding
- other than UTF-8 (e.g. latin-1), then an appropriate *encoding* name must be
- specified. Encodings that are not ASCII based (such as UCS-2) are not
- allowed and should be decoded to :class:`unicode` first.
-
- If *s* is a :class:`str` then decoded JSON strings that contain
- only ASCII characters may be parsed as :class:`str` for performance and
- memory reasons. If your code expects only :class:`unicode` the appropriate
- solution is decode *s* to :class:`unicode` prior to calling loads.
-
- The other arguments have the same meaning as in :func:`load`.
-
-
-Encoders and decoders
----------------------
-
-.. class:: JSONDecoder([encoding[, object_hook[, parse_float[, parse_int[, parse_constant[, object_pairs_hook[, strict]]]]]]])
-
- Simple JSON decoder.
-
- Performs the following translations in decoding by default:
-
- +---------------+-------------------+
- | JSON | Python |
- +===============+===================+
- | object | dict |
- +---------------+-------------------+
- | array | list |
- +---------------+-------------------+
- | string | unicode |
- +---------------+-------------------+
- | number (int) | int, long |
- +---------------+-------------------+
- | number (real) | float |
- +---------------+-------------------+
- | true | True |
- +---------------+-------------------+
- | false | False |
- +---------------+-------------------+
- | null | None |
- +---------------+-------------------+
-
- It also understands ``NaN``, ``Infinity``, and ``-Infinity`` as their
- corresponding ``float`` values, which is outside the JSON spec.
-
- *encoding* determines the encoding used to interpret any :class:`str` objects
- decoded by this instance (``'utf-8'`` by default). It has no effect when decoding
- :class:`unicode` objects.
-
- Note that currently only encodings that are a superset of ASCII work, strings
- of other encodings should be passed in as :class:`unicode`.
-
- *object_hook* is an optional function that will be called with the result of
- every JSON object decoded and its return value will be used in place of the
- given :class:`dict`. This can be used to provide custom deserializations
- (e.g. to support JSON-RPC class hinting).
-
- *object_pairs_hook* is an optional function that will be called with the
- result of any object literal decode with an ordered list of pairs. The
- return value of *object_pairs_hook* will be used instead of the
- :class:`dict`. This feature can be used to implement custom decoders that
- rely on the order that the key and value pairs are decoded (for example,
- :class:`collections.OrderedDict` will remember the order of insertion). If
- *object_hook* is also defined, the *object_pairs_hook* takes priority.
-
- .. versionchanged:: 2.1.0
- Added support for *object_pairs_hook*.
-
- *parse_float*, if specified, will be called with the string of every JSON
- float to be decoded. By default, this is equivalent to ``float(num_str)``.
- This can be used to use another datatype or parser for JSON floats
- (e.g. :class:`decimal.Decimal`).
-
- *parse_int*, if specified, will be called with the string of every JSON int
- to be decoded. By default, this is equivalent to ``int(num_str)``. This can
- be used to use another datatype or parser for JSON integers
- (e.g. :class:`float`).
-
- *parse_constant*, if specified, will be called with one of the following
- strings: ``'-Infinity'``, ``'Infinity'``, ``'NaN'``. This can be used to
- raise an exception if invalid JSON numbers are encountered.
-
- *strict* controls the parser's behavior when it encounters an invalid
- control character in a string. The default setting of ``True`` means that
- unescaped control characters are parse errors, if ``False`` then control
- characters will be allowed in strings.
-
- .. method:: decode(s)
-
- Return the Python representation of *s* (a :class:`str` or
- :class:`unicode` instance containing a JSON document)
-
- If *s* is a :class:`str` then decoded JSON strings that contain
- only ASCII characters may be parsed as :class:`str` for performance and
- memory reasons. If your code expects only :class:`unicode` the
- appropriate solution is decode *s* to :class:`unicode` prior to calling
- decode.
-
- .. method:: raw_decode(s)
-
- Decode a JSON document from *s* (a :class:`str` or :class:`unicode`
- beginning with a JSON document) and return a 2-tuple of the Python
- representation and the index in *s* where the document ended.
-
- This can be used to decode a JSON document from a string that may have
- extraneous data at the end.
-
-
-.. class:: JSONEncoder([skipkeys[, ensure_ascii[, check_circular[, allow_nan[, sort_keys[, indent[, separators[, encoding[, default]]]]]]]]])
-
- Extensible JSON encoder for Python data structures.
-
- Supports the following objects and types by default:
-
- +-------------------+---------------+
- | Python | JSON |
- +===================+===============+
- | dict | object |
- +-------------------+---------------+
- | list, tuple | array |
- +-------------------+---------------+
- | str, unicode | string |
- +-------------------+---------------+
- | int, long, float | number |
- +-------------------+---------------+
- | True | true |
- +-------------------+---------------+
- | False | false |
- +-------------------+---------------+
- | None | null |
- +-------------------+---------------+
-
- To extend this to recognize other objects, subclass and implement a
- :meth:`default` method with another method that returns a serializable object
- for ``o`` if possible, otherwise it should call the superclass implementation
- (to raise :exc:`TypeError`).
-
- If *skipkeys* is false (the default), then it is a :exc:`TypeError` to
- attempt encoding of keys that are not str, int, long, float or None. If
- *skipkeys* is true, such items are simply skipped.
-
- If *ensure_ascii* is true (the default), the output is guaranteed to be
- :class:`str` objects with all incoming unicode characters escaped. If
- *ensure_ascii* is false, the output will be a unicode object.
-
- If *check_circular* is false (the default), then lists, dicts, and custom
- encoded objects will be checked for circular references during encoding to
- prevent an infinite recursion (which would cause an :exc:`OverflowError`).
- Otherwise, no such check takes place.
-
- If *allow_nan* is true (the default), then ``NaN``, ``Infinity``, and
- ``-Infinity`` will be encoded as such. This behavior is not JSON
- specification compliant, but is consistent with most JavaScript based
- encoders and decoders. Otherwise, it will be a :exc:`ValueError` to encode
- such floats.
-
- If *sort_keys* is true (not the default), then the output of dictionaries
- will be sorted by key; this is useful for regression tests to ensure that
- JSON serializations can be compared on a day-to-day basis.
-
- If *indent* is a string, then JSON array elements and object members
- will be pretty-printed with a newline followed by that string repeated
- for each level of nesting. ``None`` (the default) selects the most compact
- representation without any newlines. For backwards compatibility with
- versions of simplejson earlier than 2.1.0, an integer is also accepted
- and is converted to a string with that many spaces.
-
- .. versionchanged:: 2.1.0
- Changed *indent* from an integer number of spaces to a string.
-
- If specified, *separators* should be an ``(item_separator, key_separator)``
- tuple. By default, ``(', ', ': ')`` are used. To get the most compact JSON
- representation, you should specify ``(',', ':')`` to eliminate whitespace.
-
- If specified, *default* should be a function that gets called for objects
- that can't otherwise be serialized. It should return a JSON encodable
- version of the object or raise a :exc:`TypeError`.
-
- If *encoding* is not ``None``, then all input strings will be transformed
- into unicode using that encoding prior to JSON-encoding. The default is
- ``'utf-8'``.
-
-
- .. method:: default(o)
-
- Implement this method in a subclass such that it returns a serializable
- object for *o*, or calls the base implementation (to raise a
- :exc:`TypeError`).
-
- For example, to support arbitrary iterators, you could implement default
- like this::
-
- def default(self, o):
- try:
- iterable = iter(o)
- except TypeError:
- pass
- else:
- return list(iterable)
- return JSONEncoder.default(self, o)
-
-
- .. method:: encode(o)
-
- Return a JSON string representation of a Python data structure, *o*. For
- example::
-
- >>> import simplejson as json
- >>> json.JSONEncoder().encode({"foo": ["bar", "baz"]})
- '{"foo": ["bar", "baz"]}'
-
-
- .. method:: iterencode(o)
-
- Encode the given object, *o*, and yield each string representation as
- available. For example::
-
- for chunk in JSONEncoder().iterencode(bigobject):
- mysocket.write(chunk)
-
- Note that :meth:`encode` has much better performance than
- :meth:`iterencode`.
-
-.. class:: JSONEncoderForHTML([skipkeys[, ensure_ascii[, check_circular[, allow_nan[, sort_keys[, indent[, separators[, encoding[, default]]]]]]]]])
-
- Subclass of :class:`JSONEncoder` that escapes &, <, and > for embedding in HTML.
-
- .. versionchanged:: 2.1.0
- New in 2.1.0
deleted file mode 100644
--- a/mail/test/resources/simplejson-2.1.6/scripts/make_docs.py
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/usr/bin/env python
-import os
-import subprocess
-import shutil
-
-SPHINX_BUILD = 'sphinx-build'
-
-DOCTREES_DIR = 'build/doctrees'
-HTML_DIR = 'docs'
-for dirname in DOCTREES_DIR, HTML_DIR:
- if not os.path.exists(dirname):
- os.makedirs(dirname)
-
-open(os.path.join(HTML_DIR, '.nojekyll'), 'w').close()
-res = subprocess.call([
- SPHINX_BUILD, '-d', DOCTREES_DIR, '-b', 'html', '.', 'docs',
-])
-raise SystemExit(res)
deleted file mode 100644
--- a/mail/test/resources/simplejson-2.1.6/setup.cfg
+++ /dev/null
@@ -1,5 +0,0 @@
-[egg_info]
-tag_build =
-tag_date = 0
-tag_svn_revision = 0
-
deleted file mode 100644
--- a/mail/test/resources/simplejson-2.1.6/setup.py
+++ /dev/null
@@ -1,102 +0,0 @@
-#!/usr/bin/env python
-
-import sys
-try:
- import setuptools
-except ImportError:
- from ez_setup import use_setuptools
- use_setuptools()
-
-from setuptools import setup, find_packages, Extension, Feature
-from distutils.command.build_ext import build_ext
-from distutils.errors import CCompilerError, DistutilsExecError, \
- DistutilsPlatformError
-
-IS_PYPY = hasattr(sys, 'pypy_translation_info')
-VERSION = '2.1.6'
-DESCRIPTION = "Simple, fast, extensible JSON encoder/decoder for Python"
-LONG_DESCRIPTION = open('README.rst', 'r').read()
-
-CLASSIFIERS = filter(None, map(str.strip,
-"""
-Intended Audience :: Developers
-License :: OSI Approved :: MIT License
-Programming Language :: Python
-Topic :: Software Development :: Libraries :: Python Modules
-""".splitlines()))
-
-
-speedups = Feature(
- "optional C speed-enhancement module",
- standard=True,
- ext_modules = [
- Extension("simplejson._speedups", ["simplejson/_speedups.c"]),
- ],
-)
-
-if sys.platform == 'win32' and sys.version_info > (2, 6):
- # 2.6's distutils.msvc9compiler can raise an IOError when failing to
- # find the compiler
- ext_errors = (CCompilerError, DistutilsExecError, DistutilsPlatformError,
- IOError)
-else:
- ext_errors = (CCompilerError, DistutilsExecError, DistutilsPlatformError)
-
-class BuildFailed(Exception):
- pass
-
-class ve_build_ext(build_ext):
- # This class allows C extension building to fail.
-
- def run(self):
- try:
- build_ext.run(self)
- except DistutilsPlatformError, x:
- raise BuildFailed()
-
- def build_extension(self, ext):
- try:
- build_ext.build_extension(self, ext)
- except ext_errors, x:
- raise BuildFailed()
-
-def run_setup(with_binary):
- if with_binary:
- features = {'speedups': speedups}
- else:
- features = {}
-
- setup(
- name="simplejson",
- version=VERSION,
- description=DESCRIPTION,
- long_description=LONG_DESCRIPTION,
- classifiers=CLASSIFIERS,
- author="Bob Ippolito",
- author_email="bob@redivi.com",
- url="http://github.com/simplejson/simplejson",
- license="MIT License",
- packages=find_packages(exclude=['ez_setup']),
- platforms=['any'],
- test_suite="simplejson.tests.all_tests_suite",
- zip_safe=True,
- features=features,
- cmdclass={'build_ext': ve_build_ext},
- )
-
-try:
- run_setup(not IS_PYPY)
-except BuildFailed:
- BUILD_EXT_WARNING = "WARNING: The C extension could not be compiled, speedups are not enabled."
- print '*' * 75
- print BUILD_EXT_WARNING
- print "Failure information, if any, is above."
- print "I'm retrying the build without the C extension now."
- print '*' * 75
-
- run_setup(False)
-
- print '*' * 75
- print BUILD_EXT_WARNING
- print "Plain-Python installation succeeded."
- print '*' * 75
deleted file mode 100644
--- a/mail/test/resources/simplejson-2.1.6/simplejson/__init__.py
+++ /dev/null
@@ -1,438 +0,0 @@
-r"""JSON (JavaScript Object Notation) <http://json.org> is a subset of
-JavaScript syntax (ECMA-262 3rd edition) used as a lightweight data
-interchange format.
-
-:mod:`simplejson` exposes an API familiar to users of the standard library
-:mod:`marshal` and :mod:`pickle` modules. It is the externally maintained
-version of the :mod:`json` library contained in Python 2.6, but maintains
-compatibility with Python 2.4 and Python 2.5 and (currently) has
-significant performance advantages, even without using the optional C
-extension for speedups.
-
-Encoding basic Python object hierarchies::
-
- >>> import simplejson as json
- >>> json.dumps(['foo', {'bar': ('baz', None, 1.0, 2)}])
- '["foo", {"bar": ["baz", null, 1.0, 2]}]'
- >>> print json.dumps("\"foo\bar")
- "\"foo\bar"
- >>> print json.dumps(u'\u1234')
- "\u1234"
- >>> print json.dumps('\\')
- "\\"
- >>> print json.dumps({"c": 0, "b": 0, "a": 0}, sort_keys=True)
- {"a": 0, "b": 0, "c": 0}
- >>> from StringIO import StringIO
- >>> io = StringIO()
- >>> json.dump(['streaming API'], io)
- >>> io.getvalue()
- '["streaming API"]'
-
-Compact encoding::
-
- >>> import simplejson as json
- >>> json.dumps([1,2,3,{'4': 5, '6': 7}], separators=(',',':'))
- '[1,2,3,{"4":5,"6":7}]'
-
-Pretty printing::
-
- >>> import simplejson as json
- >>> s = json.dumps({'4': 5, '6': 7}, sort_keys=True, indent=' ')
- >>> print '\n'.join([l.rstrip() for l in s.splitlines()])
- {
- "4": 5,
- "6": 7
- }
-
-Decoding JSON::
-
- >>> import simplejson as json
- >>> obj = [u'foo', {u'bar': [u'baz', None, 1.0, 2]}]
- >>> json.loads('["foo", {"bar":["baz", null, 1.0, 2]}]') == obj
- True
- >>> json.loads('"\\"foo\\bar"') == u'"foo\x08ar'
- True
- >>> from StringIO import StringIO
- >>> io = StringIO('["streaming API"]')
- >>> json.load(io)[0] == 'streaming API'
- True
-
-Specializing JSON object decoding::
-
- >>> import simplejson as json
- >>> def as_complex(dct):
- ... if '__complex__' in dct:
- ... return complex(dct['real'], dct['imag'])
- ... return dct
- ...
- >>> json.loads('{"__complex__": true, "real": 1, "imag": 2}',
- ... object_hook=as_complex)
- (1+2j)
- >>> from decimal import Decimal
- >>> json.loads('1.1', parse_float=Decimal) == Decimal('1.1')
- True
-
-Specializing JSON object encoding::
-
- >>> import simplejson as json
- >>> def encode_complex(obj):
- ... if isinstance(obj, complex):
- ... return [obj.real, obj.imag]
- ... raise TypeError(repr(o) + " is not JSON serializable")
- ...
- >>> json.dumps(2 + 1j, default=encode_complex)
- '[2.0, 1.0]'
- >>> json.JSONEncoder(default=encode_complex).encode(2 + 1j)
- '[2.0, 1.0]'
- >>> ''.join(json.JSONEncoder(default=encode_complex).iterencode(2 + 1j))
- '[2.0, 1.0]'
-
-
-Using simplejson.tool from the shell to validate and pretty-print::
-
- $ echo '{"json":"obj"}' | python -m simplejson.tool
- {
- "json": "obj"
- }
- $ echo '{ 1.2:3.4}' | python -m simplejson.tool
- Expecting property name: line 1 column 2 (char 2)
-"""
-__version__ = '2.1.6'
-__all__ = [
- 'dump', 'dumps', 'load', 'loads',
- 'JSONDecoder', 'JSONDecodeError', 'JSONEncoder',
- 'OrderedDict',
-]
-
-__author__ = 'Bob Ippolito <bob@redivi.com>'
-
-from decimal import Decimal
-
-from decoder import JSONDecoder, JSONDecodeError
-from encoder import JSONEncoder
-def _import_OrderedDict():
- import collections
- try:
- return collections.OrderedDict
- except AttributeError:
- import ordered_dict
- return ordered_dict.OrderedDict
-OrderedDict = _import_OrderedDict()
-
-def _import_c_make_encoder():
- try:
- from simplejson._speedups import make_encoder
- return make_encoder
- except ImportError:
- return None
-
-_default_encoder = JSONEncoder(
- skipkeys=False,
- ensure_ascii=True,
- check_circular=True,
- allow_nan=True,
- indent=None,
- separators=None,
- encoding='utf-8',
- default=None,
- use_decimal=False,
-)
-
-def dump(obj, fp, skipkeys=False, ensure_ascii=True, check_circular=True,
- allow_nan=True, cls=None, indent=None, separators=None,
- encoding='utf-8', default=None, use_decimal=False, **kw):
- """Serialize ``obj`` as a JSON formatted stream to ``fp`` (a
- ``.write()``-supporting file-like object).
-
- If ``skipkeys`` is true then ``dict`` keys that are not basic types
- (``str``, ``unicode``, ``int``, ``long``, ``float``, ``bool``, ``None``)
- will be skipped instead of raising a ``TypeError``.
-
- If ``ensure_ascii`` is false, then the some chunks written to ``fp``
- may be ``unicode`` instances, subject to normal Python ``str`` to
- ``unicode`` coercion rules. Unless ``fp.write()`` explicitly
- understands ``unicode`` (as in ``codecs.getwriter()``) this is likely
- to cause an error.
-
- If ``check_circular`` is false, then the circular reference check
- for container types will be skipped and a circular reference will
- result in an ``OverflowError`` (or worse).
-
- If ``allow_nan`` is false, then it will be a ``ValueError`` to
- serialize out of range ``float`` values (``nan``, ``inf``, ``-inf``)
- in strict compliance of the JSON specification, instead of using the
- JavaScript equivalents (``NaN``, ``Infinity``, ``-Infinity``).
-
- If *indent* is a string, then JSON array elements and object members
- will be pretty-printed with a newline followed by that string repeated
- for each level of nesting. ``None`` (the default) selects the most compact
- representation without any newlines. For backwards compatibility with
- versions of simplejson earlier than 2.1.0, an integer is also accepted
- and is converted to a string with that many spaces.
-
- If ``separators`` is an ``(item_separator, dict_separator)`` tuple
- then it will be used instead of the default ``(', ', ': ')`` separators.
- ``(',', ':')`` is the most compact JSON representation.
-
- ``encoding`` is the character encoding for str instances, default is UTF-8.
-
- ``default(obj)`` is a function that should return a serializable version
- of obj or raise TypeError. The default simply raises TypeError.
-
- If *use_decimal* is true (default: ``False``) then decimal.Decimal
- will be natively serialized to JSON with full precision.
-
- To use a custom ``JSONEncoder`` subclass (e.g. one that overrides the
- ``.default()`` method to serialize additional types), specify it with
- the ``cls`` kwarg.
-
- """
- # cached encoder
- if (not skipkeys and ensure_ascii and
- check_circular and allow_nan and
- cls is None and indent is None and separators is None and
- encoding == 'utf-8' and default is None and not use_decimal
- and not kw):
- iterable = _default_encoder.iterencode(obj)
- else:
- if cls is None:
- cls = JSONEncoder
- iterable = cls(skipkeys=skipkeys, ensure_ascii=ensure_ascii,
- check_circular=check_circular, allow_nan=allow_nan, indent=indent,
- separators=separators, encoding=encoding,
- default=default, use_decimal=use_decimal, **kw).iterencode(obj)
- # could accelerate with writelines in some versions of Python, at
- # a debuggability cost
- for chunk in iterable:
- fp.write(chunk)
-
-
-def dumps(obj, skipkeys=False, ensure_ascii=True, check_circular=True,
- allow_nan=True, cls=None, indent=None, separators=None,
- encoding='utf-8', default=None, use_decimal=False, **kw):
- """Serialize ``obj`` to a JSON formatted ``str``.
-
- If ``skipkeys`` is false then ``dict`` keys that are not basic types
- (``str``, ``unicode``, ``int``, ``long``, ``float``, ``bool``, ``None``)
- will be skipped instead of raising a ``TypeError``.
-
- If ``ensure_ascii`` is false, then the return value will be a
- ``unicode`` instance subject to normal Python ``str`` to ``unicode``
- coercion rules instead of being escaped to an ASCII ``str``.
-
- If ``check_circular`` is false, then the circular reference check
- for container types will be skipped and a circular reference will
- result in an ``OverflowError`` (or worse).
-
- If ``allow_nan`` is false, then it will be a ``ValueError`` to
- serialize out of range ``float`` values (``nan``, ``inf``, ``-inf``) in
- strict compliance of the JSON specification, instead of using the
- JavaScript equivalents (``NaN``, ``Infinity``, ``-Infinity``).
-
- If ``indent`` is a string, then JSON array elements and object members
- will be pretty-printed with a newline followed by that string repeated
- for each level of nesting. ``None`` (the default) selects the most compact
- representation without any newlines. For backwards compatibility with
- versions of simplejson earlier than 2.1.0, an integer is also accepted
- and is converted to a string with that many spaces.
-
- If ``separators`` is an ``(item_separator, dict_separator)`` tuple
- then it will be used instead of the default ``(', ', ': ')`` separators.
- ``(',', ':')`` is the most compact JSON representation.
-
- ``encoding`` is the character encoding for str instances, default is UTF-8.
-
- ``default(obj)`` is a function that should return a serializable version
- of obj or raise TypeError. The default simply raises TypeError.
-
- If *use_decimal* is true (default: ``False``) then decimal.Decimal
- will be natively serialized to JSON with full precision.
-
- To use a custom ``JSONEncoder`` subclass (e.g. one that overrides the
- ``.default()`` method to serialize additional types), specify it with
- the ``cls`` kwarg.
-
- """
- # cached encoder
- if (not skipkeys and ensure_ascii and
- check_circular and allow_nan and
- cls is None and indent is None and separators is None and
- encoding == 'utf-8' and default is None and not use_decimal
- and not kw):
- return _default_encoder.encode(obj)
- if cls is None:
- cls = JSONEncoder
- return cls(
- skipkeys=skipkeys, ensure_ascii=ensure_ascii,
- check_circular=check_circular, allow_nan=allow_nan, indent=indent,
- separators=separators, encoding=encoding, default=default,
- use_decimal=use_decimal, **kw).encode(obj)
-
-
-_default_decoder = JSONDecoder(encoding=None, object_hook=None,
- object_pairs_hook=None)
-
-
-def load(fp, encoding=None, cls=None, object_hook=None, parse_float=None,
- parse_int=None, parse_constant=None, object_pairs_hook=None,
- use_decimal=False, **kw):
- """Deserialize ``fp`` (a ``.read()``-supporting file-like object containing
- a JSON document) to a Python object.
-
- *encoding* determines the encoding used to interpret any
- :class:`str` objects decoded by this instance (``'utf-8'`` by
- default). It has no effect when decoding :class:`unicode` objects.
-
- Note that currently only encodings that are a superset of ASCII work,
- strings of other encodings should be passed in as :class:`unicode`.
-
- *object_hook*, if specified, will be called with the result of every
- JSON object decoded and its return value will be used in place of the
- given :class:`dict`. This can be used to provide custom
- deserializations (e.g. to support JSON-RPC class hinting).
-
- *object_pairs_hook* is an optional function that will be called with
- the result of any object literal decode with an ordered list of pairs.
- The return value of *object_pairs_hook* will be used instead of the
- :class:`dict`. This feature can be used to implement custom decoders
- that rely on the order that the key and value pairs are decoded (for
- example, :func:`collections.OrderedDict` will remember the order of
- insertion). If *object_hook* is also defined, the *object_pairs_hook*
- takes priority.
-
- *parse_float*, if specified, will be called with the string of every
- JSON float to be decoded. By default, this is equivalent to
- ``float(num_str)``. This can be used to use another datatype or parser
- for JSON floats (e.g. :class:`decimal.Decimal`).
-
- *parse_int*, if specified, will be called with the string of every
- JSON int to be decoded. By default, this is equivalent to
- ``int(num_str)``. This can be used to use another datatype or parser
- for JSON integers (e.g. :class:`float`).
-
- *parse_constant*, if specified, will be called with one of the
- following strings: ``'-Infinity'``, ``'Infinity'``, ``'NaN'``. This
- can be used to raise an exception if invalid JSON numbers are
- encountered.
-
- If *use_decimal* is true (default: ``False``) then it implies
- parse_float=decimal.Decimal for parity with ``dump``.
-
- To use a custom ``JSONDecoder`` subclass, specify it with the ``cls``
- kwarg.
-
- """
- return loads(fp.read(),
- encoding=encoding, cls=cls, object_hook=object_hook,
- parse_float=parse_float, parse_int=parse_int,
- parse_constant=parse_constant, object_pairs_hook=object_pairs_hook,
- use_decimal=use_decimal, **kw)
-
-
-def loads(s, encoding=None, cls=None, object_hook=None, parse_float=None,
- parse_int=None, parse_constant=None, object_pairs_hook=None,
- use_decimal=False, **kw):
- """Deserialize ``s`` (a ``str`` or ``unicode`` instance containing a JSON
- document) to a Python object.
-
- *encoding* determines the encoding used to interpret any
- :class:`str` objects decoded by this instance (``'utf-8'`` by
- default). It has no effect when decoding :class:`unicode` objects.
-
- Note that currently only encodings that are a superset of ASCII work,
- strings of other encodings should be passed in as :class:`unicode`.
-
- *object_hook*, if specified, will be called with the result of every
- JSON object decoded and its return value will be used in place of the
- given :class:`dict`. This can be used to provide custom
- deserializations (e.g. to support JSON-RPC class hinting).
-
- *object_pairs_hook* is an optional function that will be called with
- the result of any object literal decode with an ordered list of pairs.
- The return value of *object_pairs_hook* will be used instead of the
- :class:`dict`. This feature can be used to implement custom decoders
- that rely on the order that the key and value pairs are decoded (for
- example, :func:`collections.OrderedDict` will remember the order of
- insertion). If *object_hook* is also defined, the *object_pairs_hook*
- takes priority.
-
- *parse_float*, if specified, will be called with the string of every
- JSON float to be decoded. By default, this is equivalent to
- ``float(num_str)``. This can be used to use another datatype or parser
- for JSON floats (e.g. :class:`decimal.Decimal`).
-
- *parse_int*, if specified, will be called with the string of every
- JSON int to be decoded. By default, this is equivalent to
- ``int(num_str)``. This can be used to use another datatype or parser
- for JSON integers (e.g. :class:`float`).
-
- *parse_constant*, if specified, will be called with one of the
- following strings: ``'-Infinity'``, ``'Infinity'``, ``'NaN'``. This
- can be used to raise an exception if invalid JSON numbers are
- encountered.
-
- If *use_decimal* is true (default: ``False``) then it implies
- parse_float=decimal.Decimal for parity with ``dump``.
-
- To use a custom ``JSONDecoder`` subclass, specify it with the ``cls``
- kwarg.
-
- """
- if (cls is None and encoding is None and object_hook is None and
- parse_int is None and parse_float is None and
- parse_constant is None and object_pairs_hook is None
- and not use_decimal and not kw):
- return _default_decoder.decode(s)
- if cls is None:
- cls = JSONDecoder
- if object_hook is not None:
- kw['object_hook'] = object_hook
- if object_pairs_hook is not None:
- kw['object_pairs_hook'] = object_pairs_hook
- if parse_float is not None:
- kw['parse_float'] = parse_float
- if parse_int is not None:
- kw['parse_int'] = parse_int
- if parse_constant is not None:
- kw['parse_constant'] = parse_constant
- if use_decimal:
- if parse_float is not None:
- raise TypeError("use_decimal=True implies parse_float=Decimal")
- kw['parse_float'] = Decimal
- return cls(encoding=encoding, **kw).decode(s)
-
-
-def _toggle_speedups(enabled):
- import simplejson.decoder as dec
- import simplejson.encoder as enc
- import simplejson.scanner as scan
- c_make_encoder = _import_c_make_encoder()
- if enabled:
- dec.scanstring = dec.c_scanstring or dec.py_scanstring
- enc.c_make_encoder = c_make_encoder
- enc.encode_basestring_ascii = (enc.c_encode_basestring_ascii or
- enc.py_encode_basestring_ascii)
- scan.make_scanner = scan.c_make_scanner or scan.py_make_scanner
- else:
- dec.scanstring = dec.py_scanstring
- enc.c_make_encoder = None
- enc.encode_basestring_ascii = enc.py_encode_basestring_ascii
- scan.make_scanner = scan.py_make_scanner
- dec.make_scanner = scan.make_scanner
- global _default_decoder
- _default_decoder = JSONDecoder(
- encoding=None,
- object_hook=None,
- object_pairs_hook=None,
- )
- global _default_encoder
- _default_encoder = JSONEncoder(
- skipkeys=False,
- ensure_ascii=True,
- check_circular=True,
- allow_nan=True,
- indent=None,
- separators=None,
- encoding='utf-8',
- default=None,
- )
deleted file mode 100644
--- a/mail/test/resources/simplejson-2.1.6/simplejson/_speedups.c
+++ /dev/null
@@ -1,2652 +0,0 @@
-#include "Python.h"
-#include "structmember.h"
-#if PY_VERSION_HEX < 0x02070000 && !defined(PyOS_string_to_double)
-#define PyOS_string_to_double json_PyOS_string_to_double
-static double
-json_PyOS_string_to_double(const char *s, char **endptr, PyObject *overflow_exception);
-static double
-json_PyOS_string_to_double(const char *s, char **endptr, PyObject *overflow_exception) {
- double x;
- assert(endptr == NULL);
- assert(overflow_exception == NULL);
- PyFPE_START_PROTECT("json_PyOS_string_to_double", return -1.0;)
- x = PyOS_ascii_atof(s);
- PyFPE_END_PROTECT(x)
- return x;
-}
-#endif
-#if PY_VERSION_HEX < 0x02060000 && !defined(Py_TYPE)
-#define Py_TYPE(ob) (((PyObject*)(ob))->ob_type)
-#endif
-#if PY_VERSION_HEX < 0x02060000 && !defined(Py_SIZE)
-#define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size)
-#endif
-#if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN)
-typedef int Py_ssize_t;
-#define PY_SSIZE_T_MAX INT_MAX
-#define PY_SSIZE_T_MIN INT_MIN
-#define PyInt_FromSsize_t PyInt_FromLong
-#define PyInt_AsSsize_t PyInt_AsLong
-#endif
-#ifndef Py_IS_FINITE
-#define Py_IS_FINITE(X) (!Py_IS_INFINITY(X) && !Py_IS_NAN(X))
-#endif
-
-#ifdef __GNUC__
-#define UNUSED __attribute__((__unused__))
-#else
-#define UNUSED
-#endif
-
-#define DEFAULT_ENCODING "utf-8"
-
-#define PyScanner_Check(op) PyObject_TypeCheck(op, &PyScannerType)
-#define PyScanner_CheckExact(op) (Py_TYPE(op) == &PyScannerType)
-#define PyEncoder_Check(op) PyObject_TypeCheck(op, &PyEncoderType)
-#define PyEncoder_CheckExact(op) (Py_TYPE(op) == &PyEncoderType)
-#define Decimal_Check(op) (PyObject_TypeCheck(op, DecimalTypePtr))
-
-static PyTypeObject PyScannerType;
-static PyTypeObject PyEncoderType;
-static PyTypeObject *DecimalTypePtr;
-
-typedef struct _PyScannerObject {
- PyObject_HEAD
- PyObject *encoding;
- PyObject *strict;
- PyObject *object_hook;
- PyObject *pairs_hook;
- PyObject *parse_float;
- PyObject *parse_int;
- PyObject *parse_constant;
- PyObject *memo;
-} PyScannerObject;
-
-static PyMemberDef scanner_members[] = {
- {"encoding", T_OBJECT, offsetof(PyScannerObject, encoding), READONLY, "encoding"},
- {"strict", T_OBJECT, offsetof(PyScannerObject, strict), READONLY, "strict"},
- {"object_hook", T_OBJECT, offsetof(PyScannerObject, object_hook), READONLY, "object_hook"},
- {"object_pairs_hook", T_OBJECT, offsetof(PyScannerObject, pairs_hook), READONLY, "object_pairs_hook"},
- {"parse_float", T_OBJECT, offsetof(PyScannerObject, parse_float), READONLY, "parse_float"},
- {"parse_int", T_OBJECT, offsetof(PyScannerObject, parse_int), READONLY, "parse_int"},
- {"parse_constant", T_OBJECT, offsetof(PyScannerObject, parse_constant), READONLY, "parse_constant"},
- {NULL}
-};
-
-typedef struct _PyEncoderObject {
- PyObject_HEAD
- PyObject *markers;
- PyObject *defaultfn;
- PyObject *encoder;
- PyObject *indent;
- PyObject *key_separator;
- PyObject *item_separator;
- PyObject *sort_keys;
- PyObject *skipkeys;
- PyObject *key_memo;
- int fast_encode;
- int allow_nan;
- int use_decimal;
-} PyEncoderObject;
-
-static PyMemberDef encoder_members[] = {
- {"markers", T_OBJECT, offsetof(PyEncoderObject, markers), READONLY, "markers"},
- {"default", T_OBJECT, offsetof(PyEncoderObject, defaultfn), READONLY, "default"},
- {"encoder", T_OBJECT, offsetof(PyEncoderObject, encoder), READONLY, "encoder"},
- {"indent", T_OBJECT, offsetof(PyEncoderObject, indent), READONLY, "indent"},
- {"key_separator", T_OBJECT, offsetof(PyEncoderObject, key_separator), READONLY, "key_separator"},
- {"item_separator", T_OBJECT, offsetof(PyEncoderObject, item_separator), READONLY, "item_separator"},
- {"sort_keys", T_OBJECT, offsetof(PyEncoderObject, sort_keys), READONLY, "sort_keys"},
- {"skipkeys", T_OBJECT, offsetof(PyEncoderObject, skipkeys), READONLY, "skipkeys"},
- {"key_memo", T_OBJECT, offsetof(PyEncoderObject, key_memo), READONLY, "key_memo"},
- {NULL}
-};
-
-static Py_ssize_t
-ascii_escape_char(Py_UNICODE c, char *output, Py_ssize_t chars);
-static PyObject *
-ascii_escape_unicode(PyObject *pystr);
-static PyObject *
-ascii_escape_str(PyObject *pystr);
-static PyObject *
-py_encode_basestring_ascii(PyObject* self UNUSED, PyObject *pystr);
-void init_speedups(void);
-static PyObject *
-scan_once_str(PyScannerObject *s, PyObject *pystr, Py_ssize_t idx, Py_ssize_t *next_idx_ptr);
-static PyObject *
-scan_once_unicode(PyScannerObject *s, PyObject *pystr, Py_ssize_t idx, Py_ssize_t *next_idx_ptr);
-static PyObject *
-_build_rval_index_tuple(PyObject *rval, Py_ssize_t idx);
-static PyObject *
-scanner_new(PyTypeObject *type, PyObject *args, PyObject *kwds);
-static int
-scanner_init(PyObject *self, PyObject *args, PyObject *kwds);
-static void
-scanner_dealloc(PyObject *self);
-static int
-scanner_clear(PyObject *self);
-static PyObject *
-encoder_new(PyTypeObject *type, PyObject *args, PyObject *kwds);
-static int
-encoder_init(PyObject *self, PyObject *args, PyObject *kwds);
-static void
-encoder_dealloc(PyObject *self);
-static int
-encoder_clear(PyObject *self);
-static int
-encoder_listencode_list(PyEncoderObject *s, PyObject *rval, PyObject *seq, Py_ssize_t indent_level);
-static int
-encoder_listencode_obj(PyEncoderObject *s, PyObject *rval, PyObject *obj, Py_ssize_t indent_level);
-static int
-encoder_listencode_dict(PyEncoderObject *s, PyObject *rval, PyObject *dct, Py_ssize_t indent_level);
-static PyObject *
-_encoded_const(PyObject *obj);
-static void
-raise_errmsg(char *msg, PyObject *s, Py_ssize_t end);
-static PyObject *
-encoder_encode_string(PyEncoderObject *s, PyObject *obj);
-static int
-_convertPyInt_AsSsize_t(PyObject *o, Py_ssize_t *size_ptr);
-static PyObject *
-_convertPyInt_FromSsize_t(Py_ssize_t *size_ptr);
-static PyObject *
-encoder_encode_float(PyEncoderObject *s, PyObject *obj);
-
-#define S_CHAR(c) (c >= ' ' && c <= '~' && c != '\\' && c != '"')
-#define IS_WHITESPACE(c) (((c) == ' ') || ((c) == '\t') || ((c) == '\n') || ((c) == '\r'))
-
-#define MIN_EXPANSION 6
-#ifdef Py_UNICODE_WIDE
-#define MAX_EXPANSION (2 * MIN_EXPANSION)
-#else
-#define MAX_EXPANSION MIN_EXPANSION
-#endif
-
-static int
-_convertPyInt_AsSsize_t(PyObject *o, Py_ssize_t *size_ptr)
-{
- /* PyObject to Py_ssize_t converter */
- *size_ptr = PyInt_AsSsize_t(o);
- if (*size_ptr == -1 && PyErr_Occurred())
- return 0;
- return 1;
-}
-
-static PyObject *
-_convertPyInt_FromSsize_t(Py_ssize_t *size_ptr)
-{
- /* Py_ssize_t to PyObject converter */
- return PyInt_FromSsize_t(*size_ptr);
-}
-
-static Py_ssize_t
-ascii_escape_char(Py_UNICODE c, char *output, Py_ssize_t chars)
-{
- /* Escape unicode code point c to ASCII escape sequences
- in char *output. output must have at least 12 bytes unused to
- accommodate an escaped surrogate pair "\uXXXX\uXXXX" */
- output[chars++] = '\\';
- switch (c) {
- case '\\': output[chars++] = (char)c; break;
- case '"': output[chars++] = (char)c; break;
- case '\b': output[chars++] = 'b'; break;
- case '\f': output[chars++] = 'f'; break;
- case '\n': output[chars++] = 'n'; break;
- case '\r': output[chars++] = 'r'; break;
- case '\t': output[chars++] = 't'; break;
- default:
-#ifdef Py_UNICODE_WIDE
- if (c >= 0x10000) {
- /* UTF-16 surrogate pair */
- Py_UNICODE v = c - 0x10000;
- c = 0xd800 | ((v >> 10) & 0x3ff);
- output[chars++] = 'u';
- output[chars++] = "0123456789abcdef"[(c >> 12) & 0xf];
- output[chars++] = "0123456789abcdef"[(c >> 8) & 0xf];
- output[chars++] = "0123456789abcdef"[(c >> 4) & 0xf];
- output[chars++] = "0123456789abcdef"[(c ) & 0xf];
- c = 0xdc00 | (v & 0x3ff);
- output[chars++] = '\\';
- }
-#endif
- output[chars++] = 'u';
- output[chars++] = "0123456789abcdef"[(c >> 12) & 0xf];
- output[chars++] = "0123456789abcdef"[(c >> 8) & 0xf];
- output[chars++] = "0123456789abcdef"[(c >> 4) & 0xf];
- output[chars++] = "0123456789abcdef"[(c ) & 0xf];
- }
- return chars;
-}
-
-static PyObject *
-ascii_escape_unicode(PyObject *pystr)
-{
- /* Take a PyUnicode pystr and return a new ASCII-only escaped PyString */
- Py_ssize_t i;
- Py_ssize_t input_chars;
- Py_ssize_t output_size;
- Py_ssize_t max_output_size;
- Py_ssize_t chars;
- PyObject *rval;
- char *output;
- Py_UNICODE *input_unicode;
-
- input_chars = PyUnicode_GET_SIZE(pystr);
- input_unicode = PyUnicode_AS_UNICODE(pystr);
-
- /* One char input can be up to 6 chars output, estimate 4 of these */
- output_size = 2 + (MIN_EXPANSION * 4) + input_chars;
- max_output_size = 2 + (input_chars * MAX_EXPANSION);
- rval = PyString_FromStringAndSize(NULL, output_size);
- if (rval == NULL) {
- return NULL;
- }
- output = PyString_AS_STRING(rval);
- chars = 0;
- output[chars++] = '"';
- for (i = 0; i < input_chars; i++) {
- Py_UNICODE c = input_unicode[i];
- if (S_CHAR(c)) {
- output[chars++] = (char)c;
- }
- else {
- chars = ascii_escape_char(c, output, chars);
- }
- if (output_size - chars < (1 + MAX_EXPANSION)) {
- /* There's more than four, so let's resize by a lot */
- Py_ssize_t new_output_size = output_size * 2;
- /* This is an upper bound */
- if (new_output_size > max_output_size) {
- new_output_size = max_output_size;
- }
- /* Make sure that the output size changed before resizing */
- if (new_output_size != output_size) {
- output_size = new_output_size;
- if (_PyString_Resize(&rval, output_size) == -1) {
- return NULL;
- }
- output = PyString_AS_STRING(rval);
- }
- }
- }
- output[chars++] = '"';
- if (_PyString_Resize(&rval, chars) == -1) {
- return NULL;
- }
- return rval;
-}
-
-static PyObject *
-ascii_escape_str(PyObject *pystr)
-{
- /* Take a PyString pystr and return a new ASCII-only escaped PyString */
- Py_ssize_t i;
- Py_ssize_t input_chars;
- Py_ssize_t output_size;
- Py_ssize_t chars;
- PyObject *rval;
- char *output;
- char *input_str;
-
- input_chars = PyString_GET_SIZE(pystr);
- input_str = PyString_AS_STRING(pystr);
-
- /* Fast path for a string that's already ASCII */
- for (i = 0; i < input_chars; i++) {
- Py_UNICODE c = (Py_UNICODE)(unsigned char)input_str[i];
- if (!S_CHAR(c)) {
- /* If we have to escape something, scan the string for unicode */
- Py_ssize_t j;
- for (j = i; j < input_chars; j++) {
- c = (Py_UNICODE)(unsigned char)input_str[j];
- if (c > 0x7f) {
- /* We hit a non-ASCII character, bail to unicode mode */
- PyObject *uni;
- uni = PyUnicode_DecodeUTF8(input_str, input_chars, "strict");
- if (uni == NULL) {
- return NULL;
- }
- rval = ascii_escape_unicode(uni);
- Py_DECREF(uni);
- return rval;
- }
- }
- break;
- }
- }
-
- if (i == input_chars) {
- /* Input is already ASCII */
- output_size = 2 + input_chars;
- }
- else {
- /* One char input can be up to 6 chars output, estimate 4 of these */
- output_size = 2 + (MIN_EXPANSION * 4) + input_chars;
- }
- rval = PyString_FromStringAndSize(NULL, output_size);
- if (rval == NULL) {
- return NULL;
- }
- output = PyString_AS_STRING(rval);
- output[0] = '"';
-
- /* We know that everything up to i is ASCII already */
- chars = i + 1;
- memcpy(&output[1], input_str, i);
-
- for (; i < input_chars; i++) {
- Py_UNICODE c = (Py_UNICODE)(unsigned char)input_str[i];
- if (S_CHAR(c)) {
- output[chars++] = (char)c;
- }
- else {
- chars = ascii_escape_char(c, output, chars);
- }
- /* An ASCII char can't possibly expand to a surrogate! */
- if (output_size - chars < (1 + MIN_EXPANSION)) {
- /* There's more than four, so let's resize by a lot */
- output_size *= 2;
- if (output_size > 2 + (input_chars * MIN_EXPANSION)) {
- output_size = 2 + (input_chars * MIN_EXPANSION);
- }
- if (_PyString_Resize(&rval, output_size) == -1) {
- return NULL;
- }
- output = PyString_AS_STRING(rval);
- }
- }
- output[chars++] = '"';
- if (_PyString_Resize(&rval, chars) == -1) {
- return NULL;
- }
- return rval;
-}
-
-static void
-raise_errmsg(char *msg, PyObject *s, Py_ssize_t end)
-{
- /* Use the Python function simplejson.decoder.errmsg to raise a nice
- looking ValueError exception */
- static PyObject *JSONDecodeError = NULL;
- PyObject *exc;
- if (JSONDecodeError == NULL) {
- PyObject *decoder = PyImport_ImportModule("simplejson.decoder");
- if (decoder == NULL)
- return;
- JSONDecodeError = PyObject_GetAttrString(decoder, "JSONDecodeError");
- Py_DECREF(decoder);
- if (JSONDecodeError == NULL)
- return;
- }
- exc = PyObject_CallFunction(JSONDecodeError, "(zOO&)", msg, s, _convertPyInt_FromSsize_t, &end);
- if (exc) {
- PyErr_SetObject(JSONDecodeError, exc);
- Py_DECREF(exc);
- }
-}
-
-static PyObject *
-join_list_unicode(PyObject *lst)
-{
- /* return u''.join(lst) */
- static PyObject *joinfn = NULL;
- if (joinfn == NULL) {
- PyObject *ustr = PyUnicode_FromUnicode(NULL, 0);
- if (ustr == NULL)
- return NULL;
-
- joinfn = PyObject_GetAttrString(ustr, "join");
- Py_DECREF(ustr);
- if (joinfn == NULL)
- return NULL;
- }
- return PyObject_CallFunctionObjArgs(joinfn, lst, NULL);
-}
-
-static PyObject *
-join_list_string(PyObject *lst)
-{
- /* return ''.join(lst) */
- static PyObject *joinfn = NULL;
- if (joinfn == NULL) {
- PyObject *ustr = PyString_FromStringAndSize(NULL, 0);
- if (ustr == NULL)
- return NULL;
-
- joinfn = PyObject_GetAttrString(ustr, "join");
- Py_DECREF(ustr);
- if (joinfn == NULL)
- return NULL;
- }
- return PyObject_CallFunctionObjArgs(joinfn, lst, NULL);
-}
-
-static PyObject *
-_build_rval_index_tuple(PyObject *rval, Py_ssize_t idx) {
- /* return (rval, idx) tuple, stealing reference to rval */
- PyObject *tpl;
- PyObject *pyidx;
- /*
- steal a reference to rval, returns (rval, idx)
- */
- if (rval == NULL) {
- return NULL;
- }
- pyidx = PyInt_FromSsize_t(idx);
- if (pyidx == NULL) {
- Py_DECREF(rval);
- return NULL;
- }
- tpl = PyTuple_New(2);
- if (tpl == NULL) {
- Py_DECREF(pyidx);
- Py_DECREF(rval);
- return NULL;
- }
- PyTuple_SET_ITEM(tpl, 0, rval);
- PyTuple_SET_ITEM(tpl, 1, pyidx);
- return tpl;
-}
-
-#define APPEND_OLD_CHUNK \
- if (chunk != NULL) { \
- if (chunks == NULL) { \
- chunks = PyList_New(0); \
- if (chunks == NULL) { \
- goto bail; \
- } \
- } \
- if (PyList_Append(chunks, chunk)) { \
- goto bail; \
- } \
- Py_CLEAR(chunk); \
- }
-
-static PyObject *
-scanstring_str(PyObject *pystr, Py_ssize_t end, char *encoding, int strict, Py_ssize_t *next_end_ptr)
-{
- /* Read the JSON string from PyString pystr.
- end is the index of the first character after the quote.
- encoding is the encoding of pystr (must be an ASCII superset)
- if strict is zero then literal control characters are allowed
- *next_end_ptr is a return-by-reference index of the character
- after the end quote
-
- Return value is a new PyString (if ASCII-only) or PyUnicode
- */
- PyObject *rval;
- Py_ssize_t len = PyString_GET_SIZE(pystr);
- Py_ssize_t begin = end - 1;
- Py_ssize_t next = begin;
- int has_unicode = 0;
- char *buf = PyString_AS_STRING(pystr);
- PyObject *chunks = NULL;
- PyObject *chunk = NULL;
-
- if (end < 0 || len <= end) {
- PyErr_SetString(PyExc_ValueError, "end is out of bounds");
- goto bail;
- }
- while (1) {
- /* Find the end of the string or the next escape */
- Py_UNICODE c = 0;
- for (next = end; next < len; next++) {
- c = (unsigned char)buf[next];
- if (c == '"' || c == '\\') {
- break;
- }
- else if (strict && c <= 0x1f) {
- raise_errmsg("Invalid control character at", pystr, next);
- goto bail;
- }
- else if (c > 0x7f) {
- has_unicode = 1;
- }
- }
- if (!(c == '"' || c == '\\')) {
- raise_errmsg("Unterminated string starting at", pystr, begin);
- goto bail;
- }
- /* Pick up this chunk if it's not zero length */
- if (next != end) {
- PyObject *strchunk;
- APPEND_OLD_CHUNK
- strchunk = PyString_FromStringAndSize(&buf[end], next - end);
- if (strchunk == NULL) {
- goto bail;
- }
- if (has_unicode) {
- chunk = PyUnicode_FromEncodedObject(strchunk, encoding, NULL);
- Py_DECREF(strchunk);
- if (chunk == NULL) {
- goto bail;
- }
- }
- else {
- chunk = strchunk;
- }
- }
- next++;
- if (c == '"') {
- end = next;
- break;
- }
- if (next == len) {
- raise_errmsg("Unterminated string starting at", pystr, begin);
- goto bail;
- }
- c = buf[next];
- if (c != 'u') {
- /* Non-unicode backslash escapes */
- end = next + 1;
- switch (c) {
- case '"': break;
- case '\\': break;
- case '/': break;
- case 'b': c = '\b'; break;
- case 'f': c = '\f'; break;
- case 'n': c = '\n'; break;
- case 'r': c = '\r'; break;
- case 't': c = '\t'; break;
- default: c = 0;
- }
- if (c == 0) {
- raise_errmsg("Invalid \\escape", pystr, end - 2);
- goto bail;
- }
- }
- else {
- c = 0;
- next++;
- end = next + 4;
- if (end >= len) {
- raise_errmsg("Invalid \\uXXXX escape", pystr, next - 1);
- goto bail;
- }
- /* Decode 4 hex digits */
- for (; next < end; next++) {
- Py_UNICODE digit = buf[next];
- c <<= 4;
- switch (digit) {
- case '0': case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
- c |= (digit - '0'); break;
- case 'a': case 'b': case 'c': case 'd': case 'e':
- case 'f':
- c |= (digit - 'a' + 10); break;
- case 'A': case 'B': case 'C': case 'D': case 'E':
- case 'F':
- c |= (digit - 'A' + 10); break;
- default:
- raise_errmsg("Invalid \\uXXXX escape", pystr, end - 5);
- goto bail;
- }
- }
-#ifdef Py_UNICODE_WIDE
- /* Surrogate pair */
- if ((c & 0xfc00) == 0xd800) {
- Py_UNICODE c2 = 0;
- if (end + 6 >= len) {
- raise_errmsg("Unpaired high surrogate", pystr, end - 5);
- goto bail;
- }
- if (buf[next++] != '\\' || buf[next++] != 'u') {
- raise_errmsg("Unpaired high surrogate", pystr, end - 5);
- goto bail;
- }
- end += 6;
- /* Decode 4 hex digits */
- for (; next < end; next++) {
- c2 <<= 4;
- Py_UNICODE digit = buf[next];
- switch (digit) {
- case '0': case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
- c2 |= (digit - '0'); break;
- case 'a': case 'b': case 'c': case 'd': case 'e':
- case 'f':
- c2 |= (digit - 'a' + 10); break;
- case 'A': case 'B': case 'C': case 'D': case 'E':
- case 'F':
- c2 |= (digit - 'A' + 10); break;
- default:
- raise_errmsg("Invalid \\uXXXX escape", pystr, end - 5);
- goto bail;
- }
- }
- if ((c2 & 0xfc00) != 0xdc00) {
- raise_errmsg("Unpaired high surrogate", pystr, end - 5);
- goto bail;
- }
- c = 0x10000 + (((c - 0xd800) << 10) | (c2 - 0xdc00));
- }
- else if ((c & 0xfc00) == 0xdc00) {
- raise_errmsg("Unpaired low surrogate", pystr, end - 5);
- goto bail;
- }
-#endif
- }
- if (c > 0x7f) {
- has_unicode = 1;
- }
- APPEND_OLD_CHUNK
- if (has_unicode) {
- chunk = PyUnicode_FromUnicode(&c, 1);
- if (chunk == NULL) {
- goto bail;
- }
- }
- else {
- char c_char = Py_CHARMASK(c);
- chunk = PyString_FromStringAndSize(&c_char, 1);
- if (chunk == NULL) {
- goto bail;
- }
- }
- }
-
- if (chunks == NULL) {
- if (chunk != NULL)
- rval = chunk;
- else
- rval = PyString_FromStringAndSize("", 0);
- }
- else {
- APPEND_OLD_CHUNK
- rval = join_list_string(chunks);
- if (rval == NULL) {
- goto bail;
- }
- Py_CLEAR(chunks);
- }
-
- *next_end_ptr = end;
- return rval;
-bail:
- *next_end_ptr = -1;
- Py_XDECREF(chunk);
- Py_XDECREF(chunks);
- return NULL;
-}
-
-
-static PyObject *
-scanstring_unicode(PyObject *pystr, Py_ssize_t end, int strict, Py_ssize_t *next_end_ptr)
-{
- /* Read the JSON string from PyUnicode pystr.
- end is the index of the first character after the quote.
- if strict is zero then literal control characters are allowed
- *next_end_ptr is a return-by-reference index of the character
- after the end quote
-
- Return value is a new PyUnicode
- */
- PyObject *rval;
- Py_ssize_t len = PyUnicode_GET_SIZE(pystr);
- Py_ssize_t begin = end - 1;
- Py_ssize_t next = begin;
- const Py_UNICODE *buf = PyUnicode_AS_UNICODE(pystr);
- PyObject *chunks = NULL;
- PyObject *chunk = NULL;
-
- if (end < 0 || len <= end) {
- PyErr_SetString(PyExc_ValueError, "end is out of bounds");
- goto bail;
- }
- while (1) {
- /* Find the end of the string or the next escape */
- Py_UNICODE c = 0;
- for (next = end; next < len; next++) {
- c = buf[next];
- if (c == '"' || c == '\\') {
- break;
- }
- else if (strict && c <= 0x1f) {
- raise_errmsg("Invalid control character at", pystr, next);
- goto bail;
- }
- }
- if (!(c == '"' || c == '\\')) {
- raise_errmsg("Unterminated string starting at", pystr, begin);
- goto bail;
- }
- /* Pick up this chunk if it's not zero length */
- if (next != end) {
- APPEND_OLD_CHUNK
- chunk = PyUnicode_FromUnicode(&buf[end], next - end);
- if (chunk == NULL) {
- goto bail;
- }
- }
- next++;
- if (c == '"') {
- end = next;
- break;
- }
- if (next == len) {
- raise_errmsg("Unterminated string starting at", pystr, begin);
- goto bail;
- }
- c = buf[next];
- if (c != 'u') {
- /* Non-unicode backslash escapes */
- end = next + 1;
- switch (c) {
- case '"': break;
- case '\\': break;
- case '/': break;
- case 'b': c = '\b'; break;
- case 'f': c = '\f'; break;
- case 'n': c = '\n'; break;
- case 'r': c = '\r'; break;
- case 't': c = '\t'; break;
- default: c = 0;
- }
- if (c == 0) {
- raise_errmsg("Invalid \\escape", pystr, end - 2);
- goto bail;
- }
- }
- else {
- c = 0;
- next++;
- end = next + 4;
- if (end >= len) {
- raise_errmsg("Invalid \\uXXXX escape", pystr, next - 1);
- goto bail;
- }
- /* Decode 4 hex digits */
- for (; next < end; next++) {
- Py_UNICODE digit = buf[next];
- c <<= 4;
- switch (digit) {
- case '0': case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
- c |= (digit - '0'); break;
- case 'a': case 'b': case 'c': case 'd': case 'e':
- case 'f':
- c |= (digit - 'a' + 10); break;
- case 'A': case 'B': case 'C': case 'D': case 'E':
- case 'F':
- c |= (digit - 'A' + 10); break;
- default:
- raise_errmsg("Invalid \\uXXXX escape", pystr, end - 5);
- goto bail;
- }
- }
-#ifdef Py_UNICODE_WIDE
- /* Surrogate pair */
- if ((c & 0xfc00) == 0xd800) {
- Py_UNICODE c2 = 0;
- if (end + 6 >= len) {
- raise_errmsg("Unpaired high surrogate", pystr, end - 5);
- goto bail;
- }
- if (buf[next++] != '\\' || buf[next++] != 'u') {
- raise_errmsg("Unpaired high surrogate", pystr, end - 5);
- goto bail;
- }
- end += 6;
- /* Decode 4 hex digits */
- for (; next < end; next++) {
- c2 <<= 4;
- Py_UNICODE digit = buf[next];
- switch (digit) {
- case '0': case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
- c2 |= (digit - '0'); break;
- case 'a': case 'b': case 'c': case 'd': case 'e':
- case 'f':
- c2 |= (digit - 'a' + 10); break;
- case 'A': case 'B': case 'C': case 'D': case 'E':
- case 'F':
- c2 |= (digit - 'A' + 10); break;
- default:
- raise_errmsg("Invalid \\uXXXX escape", pystr, end - 5);
- goto bail;
- }
- }
- if ((c2 & 0xfc00) != 0xdc00) {
- raise_errmsg("Unpaired high surrogate", pystr, end - 5);
- goto bail;
- }
- c = 0x10000 + (((c - 0xd800) << 10) | (c2 - 0xdc00));
- }
- else if ((c & 0xfc00) == 0xdc00) {
- raise_errmsg("Unpaired low surrogate", pystr, end - 5);
- goto bail;
- }
-#endif
- }
- APPEND_OLD_CHUNK
- chunk = PyUnicode_FromUnicode(&c, 1);
- if (chunk == NULL) {
- goto bail;
- }
- }
-
- if (chunks == NULL) {
- if (chunk != NULL)
- rval = chunk;
- else
- rval = PyUnicode_FromUnicode(NULL, 0);
- }
- else {
- APPEND_OLD_CHUNK
- rval = join_list_unicode(chunks);
- if (rval == NULL) {
- goto bail;
- }
- Py_CLEAR(chunks);
- }
- *next_end_ptr = end;
- return rval;
-bail:
- *next_end_ptr = -1;
- Py_XDECREF(chunk);
- Py_XDECREF(chunks);
- return NULL;
-}
-
-PyDoc_STRVAR(pydoc_scanstring,
- "scanstring(basestring, end, encoding, strict=True) -> (str, end)\n"
- "\n"
- "Scan the string s for a JSON string. End is the index of the\n"
- "character in s after the quote that started the JSON string.\n"
- "Unescapes all valid JSON string escape sequences and raises ValueError\n"
- "on attempt to decode an invalid string. If strict is False then literal\n"
- "control characters are allowed in the string.\n"
- "\n"
- "Returns a tuple of the decoded string and the index of the character in s\n"
- "after the end quote."
-);
-
-static PyObject *
-py_scanstring(PyObject* self UNUSED, PyObject *args)
-{
- PyObject *pystr;
- PyObject *rval;
- Py_ssize_t end;
- Py_ssize_t next_end = -1;
- char *encoding = NULL;
- int strict = 1;
- if (!PyArg_ParseTuple(args, "OO&|zi:scanstring", &pystr, _convertPyInt_AsSsize_t, &end, &encoding, &strict)) {
- return NULL;
- }
- if (encoding == NULL) {
- encoding = DEFAULT_ENCODING;
- }
- if (PyString_Check(pystr)) {
- rval = scanstring_str(pystr, end, encoding, strict, &next_end);
- }
- else if (PyUnicode_Check(pystr)) {
- rval = scanstring_unicode(pystr, end, strict, &next_end);
- }
- else {
- PyErr_Format(PyExc_TypeError,
- "first argument must be a string, not %.80s",
- Py_TYPE(pystr)->tp_name);
- return NULL;
- }
- return _build_rval_index_tuple(rval, next_end);
-}
-
-PyDoc_STRVAR(pydoc_encode_basestring_ascii,
- "encode_basestring_ascii(basestring) -> str\n"
- "\n"
- "Return an ASCII-only JSON representation of a Python string"
-);
-
-static PyObject *
-py_encode_basestring_ascii(PyObject* self UNUSED, PyObject *pystr)
-{
- /* Return an ASCII-only JSON representation of a Python string */
- /* METH_O */
- if (PyString_Check(pystr)) {
- return ascii_escape_str(pystr);
- }
- else if (PyUnicode_Check(pystr)) {
- return ascii_escape_unicode(pystr);
- }
- else {
- PyErr_Format(PyExc_TypeError,
- "first argument must be a string, not %.80s",
- Py_TYPE(pystr)->tp_name);
- return NULL;
- }
-}
-
-static void
-scanner_dealloc(PyObject *self)
-{
- /* Deallocate scanner object */
- scanner_clear(self);
- Py_TYPE(self)->tp_free(self);
-}
-
-static int
-scanner_traverse(PyObject *self, visitproc visit, void *arg)
-{
- PyScannerObject *s;
- assert(PyScanner_Check(self));
- s = (PyScannerObject *)self;
- Py_VISIT(s->encoding);
- Py_VISIT(s->strict);
- Py_VISIT(s->object_hook);
- Py_VISIT(s->pairs_hook);
- Py_VISIT(s->parse_float);
- Py_VISIT(s->parse_int);
- Py_VISIT(s->parse_constant);
- Py_VISIT(s->memo);
- return 0;
-}
-
-static int
-scanner_clear(PyObject *self)
-{
- PyScannerObject *s;
- assert(PyScanner_Check(self));
- s = (PyScannerObject *)self;
- Py_CLEAR(s->encoding);
- Py_CLEAR(s->strict);
- Py_CLEAR(s->object_hook);
- Py_CLEAR(s->pairs_hook);
- Py_CLEAR(s->parse_float);
- Py_CLEAR(s->parse_int);
- Py_CLEAR(s->parse_constant);
- Py_CLEAR(s->memo);
- return 0;
-}
-
-static PyObject *
-_parse_object_str(PyScannerObject *s, PyObject *pystr, Py_ssize_t idx, Py_ssize_t *next_idx_ptr) {
- /* Read a JSON object from PyString pystr.
- idx is the index of the first character after the opening curly brace.
- *next_idx_ptr is a return-by-reference index to the first character after
- the closing curly brace.
-
- Returns a new PyObject (usually a dict, but object_hook or
- object_pairs_hook can change that)
- */
- char *str = PyString_AS_STRING(pystr);
- Py_ssize_t end_idx = PyString_GET_SIZE(pystr) - 1;
- PyObject *rval = NULL;
- PyObject *pairs = NULL;
- PyObject *item;
- PyObject *key = NULL;
- PyObject *val = NULL;
- char *encoding = PyString_AS_STRING(s->encoding);
- int strict = PyObject_IsTrue(s->strict);
- int has_pairs_hook = (s->pairs_hook != Py_None);
- Py_ssize_t next_idx;
- if (has_pairs_hook) {
- pairs = PyList_New(0);
- if (pairs == NULL)
- return NULL;
- }
- else {
- rval = PyDict_New();
- if (rval == NULL)
- return NULL;
- }
-
- /* skip whitespace after { */
- while (idx <= end_idx && IS_WHITESPACE(str[idx])) idx++;
-
- /* only loop if the object is non-empty */
- if (idx <= end_idx && str[idx] != '}') {
- while (idx <= end_idx) {
- PyObject *memokey;
-
- /* read key */
- if (str[idx] != '"') {
- raise_errmsg("Expecting property name", pystr, idx);
- goto bail;
- }
- key = scanstring_str(pystr, idx + 1, encoding, strict, &next_idx);
- if (key == NULL)
- goto bail;
- memokey = PyDict_GetItem(s->memo, key);
- if (memokey != NULL) {
- Py_INCREF(memokey);
- Py_DECREF(key);
- key = memokey;
- }
- else {
- if (PyDict_SetItem(s->memo, key, key) < 0)
- goto bail;
- }
- idx = next_idx;
-
- /* skip whitespace between key and : delimiter, read :, skip whitespace */
- while (idx <= end_idx && IS_WHITESPACE(str[idx])) idx++;
- if (idx > end_idx || str[idx] != ':') {
- raise_errmsg("Expecting : delimiter", pystr, idx);
- goto bail;
- }
- idx++;
- while (idx <= end_idx && IS_WHITESPACE(str[idx])) idx++;
-
- /* read any JSON data type */
- val = scan_once_str(s, pystr, idx, &next_idx);
- if (val == NULL)
- goto bail;
-
- if (has_pairs_hook) {
- item = PyTuple_Pack(2, key, val);
- if (item == NULL)
- goto bail;
- Py_CLEAR(key);
- Py_CLEAR(val);
- if (PyList_Append(pairs, item) == -1) {
- Py_DECREF(item);
- goto bail;
- }
- Py_DECREF(item);
- }
- else {
- if (PyDict_SetItem(rval, key, val) < 0)
- goto bail;
- Py_CLEAR(key);
- Py_CLEAR(val);
- }
- idx = next_idx;
-
- /* skip whitespace before } or , */
- while (idx <= end_idx && IS_WHITESPACE(str[idx])) idx++;
-
- /* bail if the object is closed or we didn't get the , delimiter */
- if (idx > end_idx) break;
- if (str[idx] == '}') {
- break;
- }
- else if (str[idx] != ',') {
- raise_errmsg("Expecting , delimiter", pystr, idx);
- goto bail;
- }
- idx++;
-
- /* skip whitespace after , delimiter */
- while (idx <= end_idx && IS_WHITESPACE(str[idx])) idx++;
- }
- }
- /* verify that idx < end_idx, str[idx] should be '}' */
- if (idx > end_idx || str[idx] != '}') {
- raise_errmsg("Expecting object", pystr, end_idx);
- goto bail;
- }
-
- /* if pairs_hook is not None: rval = object_pairs_hook(pairs) */
- if (s->pairs_hook != Py_None) {
- val = PyObject_CallFunctionObjArgs(s->pairs_hook, pairs, NULL);
- if (val == NULL)
- goto bail;
- Py_DECREF(pairs);
- *next_idx_ptr = idx + 1;
- return val;
- }
-
- /* if object_hook is not None: rval = object_hook(rval) */
- if (s->object_hook != Py_None) {
- val = PyObject_CallFunctionObjArgs(s->object_hook, rval, NULL);
- if (val == NULL)
- goto bail;
- Py_DECREF(rval);
- rval = val;
- val = NULL;
- }
- *next_idx_ptr = idx + 1;
- return rval;
-bail:
- Py_XDECREF(rval);
- Py_XDECREF(key);
- Py_XDECREF(val);
- Py_XDECREF(pairs);
- return NULL;
-}
-
-static PyObject *
-_parse_object_unicode(PyScannerObject *s, PyObject *pystr, Py_ssize_t idx, Py_ssize_t *next_idx_ptr) {
- /* Read a JSON object from PyUnicode pystr.
- idx is the index of the first character after the opening curly brace.
- *next_idx_ptr is a return-by-reference index to the first character after
- the closing curly brace.
-
- Returns a new PyObject (usually a dict, but object_hook can change that)
- */
- Py_UNICODE *str = PyUnicode_AS_UNICODE(pystr);
- Py_ssize_t end_idx = PyUnicode_GET_SIZE(pystr) - 1;
- PyObject *rval = NULL;
- PyObject *pairs = NULL;
- PyObject *item;
- PyObject *key = NULL;
- PyObject *val = NULL;
- int strict = PyObject_IsTrue(s->strict);
- int has_pairs_hook = (s->pairs_hook != Py_None);
- Py_ssize_t next_idx;
-
- if (has_pairs_hook) {
- pairs = PyList_New(0);
- if (pairs == NULL)
- return NULL;
- }
- else {
- rval = PyDict_New();
- if (rval == NULL)
- return NULL;
- }
-
- /* skip whitespace after { */
- while (idx <= end_idx && IS_WHITESPACE(str[idx])) idx++;
-
- /* only loop if the object is non-empty */
- if (idx <= end_idx && str[idx] != '}') {
- while (idx <= end_idx) {
- PyObject *memokey;
-
- /* read key */
- if (str[idx] != '"') {
- raise_errmsg("Expecting property name", pystr, idx);
- goto bail;
- }
- key = scanstring_unicode(pystr, idx + 1, strict, &next_idx);
- if (key == NULL)
- goto bail;
- memokey = PyDict_GetItem(s->memo, key);
- if (memokey != NULL) {
- Py_INCREF(memokey);
- Py_DECREF(key);
- key = memokey;
- }
- else {
- if (PyDict_SetItem(s->memo, key, key) < 0)
- goto bail;
- }
- idx = next_idx;
-
- /* skip whitespace between key and : delimiter, read :, skip whitespace */
- while (idx <= end_idx && IS_WHITESPACE(str[idx])) idx++;
- if (idx > end_idx || str[idx] != ':') {
- raise_errmsg("Expecting : delimiter", pystr, idx);
- goto bail;
- }
- idx++;
- while (idx <= end_idx && IS_WHITESPACE(str[idx])) idx++;
-
- /* read any JSON term */
- val = scan_once_unicode(s, pystr, idx, &next_idx);
- if (val == NULL)
- goto bail;
-
- if (has_pairs_hook) {
- item = PyTuple_Pack(2, key, val);
- if (item == NULL)
- goto bail;
- Py_CLEAR(key);
- Py_CLEAR(val);
- if (PyList_Append(pairs, item) == -1) {
- Py_DECREF(item);
- goto bail;
- }
- Py_DECREF(item);
- }
- else {
- if (PyDict_SetItem(rval, key, val) < 0)
- goto bail;
- Py_CLEAR(key);
- Py_CLEAR(val);
- }
- idx = next_idx;
-
- /* skip whitespace before } or , */
- while (idx <= end_idx && IS_WHITESPACE(str[idx])) idx++;
-
- /* bail if the object is closed or we didn't get the , delimiter */
- if (idx > end_idx) break;
- if (str[idx] == '}') {
- break;
- }
- else if (str[idx] != ',') {
- raise_errmsg("Expecting , delimiter", pystr, idx);
- goto bail;
- }
- idx++;
-
- /* skip whitespace after , delimiter */
- while (idx <= end_idx && IS_WHITESPACE(str[idx])) idx++;
- }
- }
-
- /* verify that idx < end_idx, str[idx] should be '}' */
- if (idx > end_idx || str[idx] != '}') {
- raise_errmsg("Expecting object", pystr, end_idx);
- goto bail;
- }
-
- /* if pairs_hook is not None: rval = object_pairs_hook(pairs) */
- if (s->pairs_hook != Py_None) {
- val = PyObject_CallFunctionObjArgs(s->pairs_hook, pairs, NULL);
- if (val == NULL)
- goto bail;
- Py_DECREF(pairs);
- *next_idx_ptr = idx + 1;
- return val;
- }
-
- /* if object_hook is not None: rval = object_hook(rval) */
- if (s->object_hook != Py_None) {
- val = PyObject_CallFunctionObjArgs(s->object_hook, rval, NULL);
- if (val == NULL)
- goto bail;
- Py_DECREF(rval);
- rval = val;
- val = NULL;
- }
- *next_idx_ptr = idx + 1;
- return rval;
-bail:
- Py_XDECREF(rval);
- Py_XDECREF(key);
- Py_XDECREF(val);
- Py_XDECREF(pairs);
- return NULL;
-}
-
-static PyObject *
-_parse_array_str(PyScannerObject *s, PyObject *pystr, Py_ssize_t idx, Py_ssize_t *next_idx_ptr) {
- /* Read a JSON array from PyString pystr.
- idx is the index of the first character after the opening brace.
- *next_idx_ptr is a return-by-reference index to the first character after
- the closing brace.
-
- Returns a new PyList
- */
- char *str = PyString_AS_STRING(pystr);
- Py_ssize_t end_idx = PyString_GET_SIZE(pystr) - 1;
- PyObject *val = NULL;
- PyObject *rval = PyList_New(0);
- Py_ssize_t next_idx;
- if (rval == NULL)
- return NULL;
-
- /* skip whitespace after [ */
- while (idx <= end_idx && IS_WHITESPACE(str[idx])) idx++;
-
- /* only loop if the array is non-empty */
- if (idx <= end_idx && str[idx] != ']') {
- while (idx <= end_idx) {
-
- /* read any JSON term and de-tuplefy the (rval, idx) */
- val = scan_once_str(s, pystr, idx, &next_idx);
- if (val == NULL) {
- if (PyErr_ExceptionMatches(PyExc_StopIteration)) {
- PyErr_Clear();
- raise_errmsg("Expecting object", pystr, idx);
- }
- goto bail;
- }
-
- if (PyList_Append(rval, val) == -1)
- goto bail;
-
- Py_CLEAR(val);
- idx = next_idx;
-
- /* skip whitespace between term and , */
- while (idx <= end_idx && IS_WHITESPACE(str[idx])) idx++;
-
- /* bail if the array is closed or we didn't get the , delimiter */
- if (idx > end_idx) break;
- if (str[idx] == ']') {
- break;
- }
- else if (str[idx] != ',') {
- raise_errmsg("Expecting , delimiter", pystr, idx);
- goto bail;
- }
- idx++;
-
- /* skip whitespace after , */
- while (idx <= end_idx && IS_WHITESPACE(str[idx])) idx++;
- }
- }
-
- /* verify that idx < end_idx, str[idx] should be ']' */
- if (idx > end_idx || str[idx] != ']') {
- raise_errmsg("Expecting object", pystr, end_idx);
- goto bail;
- }
- *next_idx_ptr = idx + 1;
- return rval;
-bail:
- Py_XDECREF(val);
- Py_DECREF(rval);
- return NULL;
-}
-
-static PyObject *
-_parse_array_unicode(PyScannerObject *s, PyObject *pystr, Py_ssize_t idx, Py_ssize_t *next_idx_ptr) {
- /* Read a JSON array from PyString pystr.
- idx is the index of the first character after the opening brace.
- *next_idx_ptr is a return-by-reference index to the first character after
- the closing brace.
-
- Returns a new PyList
- */
- Py_UNICODE *str = PyUnicode_AS_UNICODE(pystr);
- Py_ssize_t end_idx = PyUnicode_GET_SIZE(pystr) - 1;
- PyObject *val = NULL;
- PyObject *rval = PyList_New(0);
- Py_ssize_t next_idx;
- if (rval == NULL)
- return NULL;
-
- /* skip whitespace after [ */
- while (idx <= end_idx && IS_WHITESPACE(str[idx])) idx++;
-
- /* only loop if the array is non-empty */
- if (idx <= end_idx && str[idx] != ']') {
- while (idx <= end_idx) {
-
- /* read any JSON term */
- val = scan_once_unicode(s, pystr, idx, &next_idx);
- if (val == NULL) {
- if (PyErr_ExceptionMatches(PyExc_StopIteration)) {
- PyErr_Clear();
- raise_errmsg("Expecting object", pystr, idx);
- }
- goto bail;
- }
-
- if (PyList_Append(rval, val) == -1)
- goto bail;
-
- Py_CLEAR(val);
- idx = next_idx;
-
- /* skip whitespace between term and , */
- while (idx <= end_idx && IS_WHITESPACE(str[idx])) idx++;
-
- /* bail if the array is closed or we didn't get the , delimiter */
- if (idx > end_idx) break;
- if (str[idx] == ']') {
- break;
- }
- else if (str[idx] != ',') {
- raise_errmsg("Expecting , delimiter", pystr, idx);
- goto bail;
- }
- idx++;
-
- /* skip whitespace after , */
- while (idx <= end_idx && IS_WHITESPACE(str[idx])) idx++;
- }
- }
-
- /* verify that idx < end_idx, str[idx] should be ']' */
- if (idx > end_idx || str[idx] != ']') {
- raise_errmsg("Expecting object", pystr, end_idx);
- goto bail;
- }
- *next_idx_ptr = idx + 1;
- return rval;
-bail:
- Py_XDECREF(val);
- Py_DECREF(rval);
- return NULL;
-}
-
-static PyObject *
-_parse_constant(PyScannerObject *s, char *constant, Py_ssize_t idx, Py_ssize_t *next_idx_ptr) {
- /* Read a JSON constant from PyString pystr.
- constant is the constant string that was found
- ("NaN", "Infinity", "-Infinity").
- idx is the index of the first character of the constant
- *next_idx_ptr is a return-by-reference index to the first character after
- the constant.
-
- Returns the result of parse_constant
- */
- PyObject *cstr;
- PyObject *rval;
- /* constant is "NaN", "Infinity", or "-Infinity" */
- cstr = PyString_InternFromString(constant);
- if (cstr == NULL)
- return NULL;
-
- /* rval = parse_constant(constant) */
- rval = PyObject_CallFunctionObjArgs(s->parse_constant, cstr, NULL);
- idx += PyString_GET_SIZE(cstr);
- Py_DECREF(cstr);
- *next_idx_ptr = idx;
- return rval;
-}
-
-static PyObject *
-_match_number_str(PyScannerObject *s, PyObject *pystr, Py_ssize_t start, Py_ssize_t *next_idx_ptr) {
- /* Read a JSON number from PyString pystr.
- idx is the index of the first character of the number
- *next_idx_ptr is a return-by-reference index to the first character after
- the number.
-
- Returns a new PyObject representation of that number:
- PyInt, PyLong, or PyFloat.
- May return other types if parse_int or parse_float are set
- */
- char *str = PyString_AS_STRING(pystr);
- Py_ssize_t end_idx = PyString_GET_SIZE(pystr) - 1;
- Py_ssize_t idx = start;
- int is_float = 0;
- PyObject *rval;
- PyObject *numstr;
-
- /* read a sign if it's there, make sure it's not the end of the string */
- if (str[idx] == '-') {
- idx++;
- if (idx > end_idx) {
- PyErr_SetNone(PyExc_StopIteration);
- return NULL;
- }
- }
-
- /* read as many integer digits as we find as long as it doesn't start with 0 */
- if (str[idx] >= '1' && str[idx] <= '9') {
- idx++;
- while (idx <= end_idx && str[idx] >= '0' && str[idx] <= '9') idx++;
- }
- /* if it starts with 0 we only expect one integer digit */
- else if (str[idx] == '0') {
- idx++;
- }
- /* no integer digits, error */
- else {
- PyErr_SetNone(PyExc_StopIteration);
- return NULL;
- }
-
- /* if the next char is '.' followed by a digit then read all float digits */
- if (idx < end_idx && str[idx] == '.' && str[idx + 1] >= '0' && str[idx + 1] <= '9') {
- is_float = 1;
- idx += 2;
- while (idx <= end_idx && str[idx] >= '0' && str[idx] <= '9') idx++;
- }
-
- /* if the next char is 'e' or 'E' then maybe read the exponent (or backtrack) */
- if (idx < end_idx && (str[idx] == 'e' || str[idx] == 'E')) {
-
- /* save the index of the 'e' or 'E' just in case we need to backtrack */
- Py_ssize_t e_start = idx;
- idx++;
-
- /* read an exponent sign if present */
- if (idx < end_idx && (str[idx] == '-' || str[idx] == '+')) idx++;
-
- /* read all digits */
- while (idx <= end_idx && str[idx] >= '0' && str[idx] <= '9') idx++;
-
- /* if we got a digit, then parse as float. if not, backtrack */
- if (str[idx - 1] >= '0' && str[idx - 1] <= '9') {
- is_float = 1;
- }
- else {
- idx = e_start;
- }
- }
-
- /* copy the section we determined to be a number */
- numstr = PyString_FromStringAndSize(&str[start], idx - start);
- if (numstr == NULL)
- return NULL;
- if (is_float) {
- /* parse as a float using a fast path if available, otherwise call user defined method */
- if (s->parse_float != (PyObject *)&PyFloat_Type) {
- rval = PyObject_CallFunctionObjArgs(s->parse_float, numstr, NULL);
- }
- else {
- /* rval = PyFloat_FromDouble(PyOS_ascii_atof(PyString_AS_STRING(numstr))); */
- double d = PyOS_string_to_double(PyString_AS_STRING(numstr),
- NULL, NULL);
- if (d == -1.0 && PyErr_Occurred())
- return NULL;
- rval = PyFloat_FromDouble(d);
- }
- }
- else {
- /* parse as an int using a fast path if available, otherwise call user defined method */
- if (s->parse_int != (PyObject *)&PyInt_Type) {
- rval = PyObject_CallFunctionObjArgs(s->parse_int, numstr, NULL);
- }
- else {
- rval = PyInt_FromString(PyString_AS_STRING(numstr), NULL, 10);
- }
- }
- Py_DECREF(numstr);
- *next_idx_ptr = idx;
- return rval;
-}
-
-static PyObject *
-_match_number_unicode(PyScannerObject *s, PyObject *pystr, Py_ssize_t start, Py_ssize_t *next_idx_ptr) {
- /* Read a JSON number from PyUnicode pystr.
- idx is the index of the first character of the number
- *next_idx_ptr is a return-by-reference index to the first character after
- the number.
-
- Returns a new PyObject representation of that number:
- PyInt, PyLong, or PyFloat.
- May return other types if parse_int or parse_float are set
- */
- Py_UNICODE *str = PyUnicode_AS_UNICODE(pystr);
- Py_ssize_t end_idx = PyUnicode_GET_SIZE(pystr) - 1;
- Py_ssize_t idx = start;
- int is_float = 0;
- PyObject *rval;
- PyObject *numstr;
-
- /* read a sign if it's there, make sure it's not the end of the string */
- if (str[idx] == '-') {
- idx++;
- if (idx > end_idx) {
- PyErr_SetNone(PyExc_StopIteration);
- return NULL;
- }
- }
-
- /* read as many integer digits as we find as long as it doesn't start with 0 */
- if (str[idx] >= '1' && str[idx] <= '9') {
- idx++;
- while (idx <= end_idx && str[idx] >= '0' && str[idx] <= '9') idx++;
- }
- /* if it starts with 0 we only expect one integer digit */
- else if (str[idx] == '0') {
- idx++;
- }
- /* no integer digits, error */
- else {
- PyErr_SetNone(PyExc_StopIteration);
- return NULL;
- }
-
- /* if the next char is '.' followed by a digit then read all float digits */
- if (idx < end_idx && str[idx] == '.' && str[idx + 1] >= '0' && str[idx + 1] <= '9') {
- is_float = 1;
- idx += 2;
- while (idx <= end_idx && str[idx] >= '0' && str[idx] <= '9') idx++;
- }
-
- /* if the next char is 'e' or 'E' then maybe read the exponent (or backtrack) */
- if (idx < end_idx && (str[idx] == 'e' || str[idx] == 'E')) {
- Py_ssize_t e_start = idx;
- idx++;
-
- /* read an exponent sign if present */
- if (idx < end_idx && (str[idx] == '-' || str[idx] == '+')) idx++;
-
- /* read all digits */
- while (idx <= end_idx && str[idx] >= '0' && str[idx] <= '9') idx++;
-
- /* if we got a digit, then parse as float. if not, backtrack */
- if (str[idx - 1] >= '0' && str[idx - 1] <= '9') {
- is_float = 1;
- }
- else {
- idx = e_start;
- }
- }
-
- /* copy the section we determined to be a number */
- numstr = PyUnicode_FromUnicode(&str[start], idx - start);
- if (numstr == NULL)
- return NULL;
- if (is_float) {
- /* parse as a float using a fast path if available, otherwise call user defined method */
- if (s->parse_float != (PyObject *)&PyFloat_Type) {
- rval = PyObject_CallFunctionObjArgs(s->parse_float, numstr, NULL);
- }
- else {
- rval = PyFloat_FromString(numstr, NULL);
- }
- }
- else {
- /* no fast path for unicode -> int, just call */
- rval = PyObject_CallFunctionObjArgs(s->parse_int, numstr, NULL);
- }
- Py_DECREF(numstr);
- *next_idx_ptr = idx;
- return rval;
-}
-
-static PyObject *
-scan_once_str(PyScannerObject *s, PyObject *pystr, Py_ssize_t idx, Py_ssize_t *next_idx_ptr)
-{
- /* Read one JSON term (of any kind) from PyString pystr.
- idx is the index of the first character of the term
- *next_idx_ptr is a return-by-reference index to the first character after
- the number.
-
- Returns a new PyObject representation of the term.
- */
- char *str = PyString_AS_STRING(pystr);
- Py_ssize_t length = PyString_GET_SIZE(pystr);
- PyObject *rval = NULL;
- int fallthrough = 0;
- if (idx >= length) {
- PyErr_SetNone(PyExc_StopIteration);
- return NULL;
- }
- if (Py_EnterRecursiveCall(" while decoding a JSON document"))
- return NULL;
- switch (str[idx]) {
- case '"':
- /* string */
- rval = scanstring_str(pystr, idx + 1,
- PyString_AS_STRING(s->encoding),
- PyObject_IsTrue(s->strict),
- next_idx_ptr);
- break;
- case '{':
- /* object */
- rval = _parse_object_str(s, pystr, idx + 1, next_idx_ptr);
- break;
- case '[':
- /* array */
- rval = _parse_array_str(s, pystr, idx + 1, next_idx_ptr);
- break;
- case 'n':
- /* null */
- if ((idx + 3 < length) && str[idx + 1] == 'u' && str[idx + 2] == 'l' && str[idx + 3] == 'l') {
- Py_INCREF(Py_None);
- *next_idx_ptr = idx + 4;
- rval = Py_None;
- }
- else
- fallthrough = 1;
- break;
- case 't':
- /* true */
- if ((idx + 3 < length) && str[idx + 1] == 'r' && str[idx + 2] == 'u' && str[idx + 3] == 'e') {
- Py_INCREF(Py_True);
- *next_idx_ptr = idx + 4;
- rval = Py_True;
- }
- else
- fallthrough = 1;
- break;
- case 'f':
- /* false */
- if ((idx + 4 < length) && str[idx + 1] == 'a' && str[idx + 2] == 'l' && str[idx + 3] == 's' && str[idx + 4] == 'e') {
- Py_INCREF(Py_False);
- *next_idx_ptr = idx + 5;
- rval = Py_False;
- }
- else
- fallthrough = 1;
- break;
- case 'N':
- /* NaN */
- if ((idx + 2 < length) && str[idx + 1] == 'a' && str[idx + 2] == 'N') {
- rval = _parse_constant(s, "NaN", idx, next_idx_ptr);
- }
- else
- fallthrough = 1;
- break;
- case 'I':
- /* Infinity */
- if ((idx + 7 < length) && str[idx + 1] == 'n' && str[idx + 2] == 'f' && str[idx + 3] == 'i' && str[idx + 4] == 'n' && str[idx + 5] == 'i' && str[idx + 6] == 't' && str[idx + 7] == 'y') {
- rval = _parse_constant(s, "Infinity", idx, next_idx_ptr);
- }
- else
- fallthrough = 1;
- break;
- case '-':
- /* -Infinity */
- if ((idx + 8 < length) && str[idx + 1] == 'I' && str[idx + 2] == 'n' && str[idx + 3] == 'f' && str[idx + 4] == 'i' && str[idx + 5] == 'n' && str[idx + 6] == 'i' && str[idx + 7] == 't' && str[idx + 8] == 'y') {
- rval = _parse_constant(s, "-Infinity", idx, next_idx_ptr);
- }
- else
- fallthrough = 1;
- break;
- default:
- fallthrough = 1;
- }
- /* Didn't find a string, object, array, or named constant. Look for a number. */
- if (fallthrough)
- rval = _match_number_str(s, pystr, idx, next_idx_ptr);
- Py_LeaveRecursiveCall();
- return rval;
-}
-
-static PyObject *
-scan_once_unicode(PyScannerObject *s, PyObject *pystr, Py_ssize_t idx, Py_ssize_t *next_idx_ptr)
-{
- /* Read one JSON term (of any kind) from PyUnicode pystr.
- idx is the index of the first character of the term
- *next_idx_ptr is a return-by-reference index to the first character after
- the number.
-
- Returns a new PyObject representation of the term.
- */
- Py_UNICODE *str = PyUnicode_AS_UNICODE(pystr);
- Py_ssize_t length = PyUnicode_GET_SIZE(pystr);
- PyObject *rval = NULL;
- int fallthrough = 0;
- if (idx >= length) {
- PyErr_SetNone(PyExc_StopIteration);
- return NULL;
- }
- if (Py_EnterRecursiveCall(" while decoding a JSON document"))
- return NULL;
- switch (str[idx]) {
- case '"':
- /* string */
- rval = scanstring_unicode(pystr, idx + 1,
- PyObject_IsTrue(s->strict),
- next_idx_ptr);
- break;
- case '{':
- /* object */
- rval = _parse_object_unicode(s, pystr, idx + 1, next_idx_ptr);
- break;
- case '[':
- /* array */
- rval = _parse_array_unicode(s, pystr, idx + 1, next_idx_ptr);
- break;
- case 'n':
- /* null */
- if ((idx + 3 < length) && str[idx + 1] == 'u' && str[idx + 2] == 'l' && str[idx + 3] == 'l') {
- Py_INCREF(Py_None);
- *next_idx_ptr = idx + 4;
- rval = Py_None;
- }
- else
- fallthrough = 1;
- break;
- case 't':
- /* true */
- if ((idx + 3 < length) && str[idx + 1] == 'r' && str[idx + 2] == 'u' && str[idx + 3] == 'e') {
- Py_INCREF(Py_True);
- *next_idx_ptr = idx + 4;
- rval = Py_True;
- }
- else
- fallthrough = 1;
- break;
- case 'f':
- /* false */
- if ((idx + 4 < length) && str[idx + 1] == 'a' && str[idx + 2] == 'l' && str[idx + 3] == 's' && str[idx + 4] == 'e') {
- Py_INCREF(Py_False);
- *next_idx_ptr = idx + 5;
- rval = Py_False;
- }
- else
- fallthrough = 1;
- break;
- case 'N':
- /* NaN */
- if ((idx + 2 < length) && str[idx + 1] == 'a' && str[idx + 2] == 'N') {
- rval = _parse_constant(s, "NaN", idx, next_idx_ptr);
- }
- else
- fallthrough = 1;
- break;
- case 'I':
- /* Infinity */
- if ((idx + 7 < length) && str[idx + 1] == 'n' && str[idx + 2] == 'f' && str[idx + 3] == 'i' && str[idx + 4] == 'n' && str[idx + 5] == 'i' && str[idx + 6] == 't' && str[idx + 7] == 'y') {
- rval = _parse_constant(s, "Infinity", idx, next_idx_ptr);
- }
- else
- fallthrough = 1;
- break;
- case '-':
- /* -Infinity */
- if ((idx + 8 < length) && str[idx + 1] == 'I' && str[idx + 2] == 'n' && str[idx + 3] == 'f' && str[idx + 4] == 'i' && str[idx + 5] == 'n' && str[idx + 6] == 'i' && str[idx + 7] == 't' && str[idx + 8] == 'y') {
- rval = _parse_constant(s, "-Infinity", idx, next_idx_ptr);
- }
- else
- fallthrough = 1;
- break;
- default:
- fallthrough = 1;
- }
- /* Didn't find a string, object, array, or named constant. Look for a number. */
- if (fallthrough)
- rval = _match_number_unicode(s, pystr, idx, next_idx_ptr);
- Py_LeaveRecursiveCall();
- return rval;
-}
-
-static PyObject *
-scanner_call(PyObject *self, PyObject *args, PyObject *kwds)
-{
- /* Python callable interface to scan_once_{str,unicode} */
- PyObject *pystr;
- PyObject *rval;
- Py_ssize_t idx;
- Py_ssize_t next_idx = -1;
- static char *kwlist[] = {"string", "idx", NULL};
- PyScannerObject *s;
- assert(PyScanner_Check(self));
- s = (PyScannerObject *)self;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "OO&:scan_once", kwlist, &pystr, _convertPyInt_AsSsize_t, &idx))
- return NULL;
-
- if (PyString_Check(pystr)) {
- rval = scan_once_str(s, pystr, idx, &next_idx);
- }
- else if (PyUnicode_Check(pystr)) {
- rval = scan_once_unicode(s, pystr, idx, &next_idx);
- }
- else {
- PyErr_Format(PyExc_TypeError,
- "first argument must be a string, not %.80s",
- Py_TYPE(pystr)->tp_name);
- return NULL;
- }
- PyDict_Clear(s->memo);
- return _build_rval_index_tuple(rval, next_idx);
-}
-
-static PyObject *
-scanner_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
-{
- PyScannerObject *s;
- s = (PyScannerObject *)type->tp_alloc(type, 0);
- if (s != NULL) {
- s->encoding = NULL;
- s->strict = NULL;
- s->object_hook = NULL;
- s->pairs_hook = NULL;
- s->parse_float = NULL;
- s->parse_int = NULL;
- s->parse_constant = NULL;
- }
- return (PyObject *)s;
-}
-
-static int
-scanner_init(PyObject *self, PyObject *args, PyObject *kwds)
-{
- /* Initialize Scanner object */
- PyObject *ctx;
- static char *kwlist[] = {"context", NULL};
- PyScannerObject *s;
-
- assert(PyScanner_Check(self));
- s = (PyScannerObject *)self;
-
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "O:make_scanner", kwlist, &ctx))
- return -1;
-
- if (s->memo == NULL) {
- s->memo = PyDict_New();
- if (s->memo == NULL)
- goto bail;
- }
-
- /* PyString_AS_STRING is used on encoding */
- s->encoding = PyObject_GetAttrString(ctx, "encoding");
- if (s->encoding == NULL)
- goto bail;
- if (s->encoding == Py_None) {
- Py_DECREF(Py_None);
- s->encoding = PyString_InternFromString(DEFAULT_ENCODING);
- }
- else if (PyUnicode_Check(s->encoding)) {
- PyObject *tmp = PyUnicode_AsEncodedString(s->encoding, NULL, NULL);
- Py_DECREF(s->encoding);
- s->encoding = tmp;
- }
- if (s->encoding == NULL || !PyString_Check(s->encoding))
- goto bail;
-
- /* All of these will fail "gracefully" so we don't need to verify them */
- s->strict = PyObject_GetAttrString(ctx, "strict");
- if (s->strict == NULL)
- goto bail;
- s->object_hook = PyObject_GetAttrString(ctx, "object_hook");
- if (s->object_hook == NULL)
- goto bail;
- s->pairs_hook = PyObject_GetAttrString(ctx, "object_pairs_hook");
- if (s->pairs_hook == NULL)
- goto bail;
- s->parse_float = PyObject_GetAttrString(ctx, "parse_float");
- if (s->parse_float == NULL)
- goto bail;
- s->parse_int = PyObject_GetAttrString(ctx, "parse_int");
- if (s->parse_int == NULL)
- goto bail;
- s->parse_constant = PyObject_GetAttrString(ctx, "parse_constant");
- if (s->parse_constant == NULL)
- goto bail;
-
- return 0;
-
-bail:
- Py_CLEAR(s->encoding);
- Py_CLEAR(s->strict);
- Py_CLEAR(s->object_hook);
- Py_CLEAR(s->pairs_hook);
- Py_CLEAR(s->parse_float);
- Py_CLEAR(s->parse_int);
- Py_CLEAR(s->parse_constant);
- return -1;
-}
-
-PyDoc_STRVAR(scanner_doc, "JSON scanner object");
-
-static
-PyTypeObject PyScannerType = {
- PyObject_HEAD_INIT(NULL)
- 0, /* tp_internal */
- "simplejson._speedups.Scanner", /* tp_name */
- sizeof(PyScannerObject), /* tp_basicsize */
- 0, /* tp_itemsize */
- scanner_dealloc, /* tp_dealloc */
- 0, /* tp_print */
- 0, /* tp_getattr */
- 0, /* tp_setattr */
- 0, /* tp_compare */
- 0, /* tp_repr */
- 0, /* tp_as_number */
- 0, /* tp_as_sequence */
- 0, /* tp_as_mapping */
- 0, /* tp_hash */
- scanner_call, /* tp_call */
- 0, /* tp_str */
- 0,/* PyObject_GenericGetAttr, */ /* tp_getattro */
- 0,/* PyObject_GenericSetAttr, */ /* tp_setattro */
- 0, /* tp_as_buffer */
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags */
- scanner_doc, /* tp_doc */
- scanner_traverse, /* tp_traverse */
- scanner_clear, /* tp_clear */
- 0, /* tp_richcompare */
- 0, /* tp_weaklistoffset */
- 0, /* tp_iter */
- 0, /* tp_iternext */
- 0, /* tp_methods */
- scanner_members, /* tp_members */
- 0, /* tp_getset */
- 0, /* tp_base */
- 0, /* tp_dict */
- 0, /* tp_descr_get */
- 0, /* tp_descr_set */
- 0, /* tp_dictoffset */
- scanner_init, /* tp_init */
- 0,/* PyType_GenericAlloc, */ /* tp_alloc */
- scanner_new, /* tp_new */
- 0,/* PyObject_GC_Del, */ /* tp_free */
-};
-
-static PyObject *
-encoder_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
-{
- PyEncoderObject *s;
- s = (PyEncoderObject *)type->tp_alloc(type, 0);
- if (s != NULL) {
- s->markers = NULL;
- s->defaultfn = NULL;
- s->encoder = NULL;
- s->indent = NULL;
- s->key_separator = NULL;
- s->item_separator = NULL;
- s->sort_keys = NULL;
- s->skipkeys = NULL;
- s->key_memo = NULL;
- }
- return (PyObject *)s;
-}
-
-static int
-encoder_init(PyObject *self, PyObject *args, PyObject *kwds)
-{
- /* initialize Encoder object */
- static char *kwlist[] = {"markers", "default", "encoder", "indent", "key_separator", "item_separator", "sort_keys", "skipkeys", "allow_nan", "key_memo", "use_decimal", NULL};
-
- PyEncoderObject *s;
- PyObject *markers, *defaultfn, *encoder, *indent, *key_separator;
- PyObject *item_separator, *sort_keys, *skipkeys, *allow_nan, *key_memo, *use_decimal;
-
- assert(PyEncoder_Check(self));
- s = (PyEncoderObject *)self;
-
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "OOOOOOOOOOO:make_encoder", kwlist,
- &markers, &defaultfn, &encoder, &indent, &key_separator, &item_separator,
- &sort_keys, &skipkeys, &allow_nan, &key_memo, &use_decimal))
- return -1;
-
- s->markers = markers;
- s->defaultfn = defaultfn;
- s->encoder = encoder;
- s->indent = indent;
- s->key_separator = key_separator;
- s->item_separator = item_separator;
- s->sort_keys = sort_keys;
- s->skipkeys = skipkeys;
- s->key_memo = key_memo;
- s->fast_encode = (PyCFunction_Check(s->encoder) && PyCFunction_GetFunction(s->encoder) == (PyCFunction)py_encode_basestring_ascii);
- s->allow_nan = PyObject_IsTrue(allow_nan);
- s->use_decimal = PyObject_IsTrue(use_decimal);
-
- Py_INCREF(s->markers);
- Py_INCREF(s->defaultfn);
- Py_INCREF(s->encoder);
- Py_INCREF(s->indent);
- Py_INCREF(s->key_separator);
- Py_INCREF(s->item_separator);
- Py_INCREF(s->sort_keys);
- Py_INCREF(s->skipkeys);
- Py_INCREF(s->key_memo);
- return 0;
-}
-
-static PyObject *
-encoder_call(PyObject *self, PyObject *args, PyObject *kwds)
-{
- /* Python callable interface to encode_listencode_obj */
- static char *kwlist[] = {"obj", "_current_indent_level", NULL};
- PyObject *obj;
- PyObject *rval;
- Py_ssize_t indent_level;
- PyEncoderObject *s;
- assert(PyEncoder_Check(self));
- s = (PyEncoderObject *)self;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "OO&:_iterencode", kwlist,
- &obj, _convertPyInt_AsSsize_t, &indent_level))
- return NULL;
- rval = PyList_New(0);
- if (rval == NULL)
- return NULL;
- if (encoder_listencode_obj(s, rval, obj, indent_level)) {
- Py_DECREF(rval);
- return NULL;
- }
- return rval;
-}
-
-static PyObject *
-_encoded_const(PyObject *obj)
-{
- /* Return the JSON string representation of None, True, False */
- if (obj == Py_None) {
- static PyObject *s_null = NULL;
- if (s_null == NULL) {
- s_null = PyString_InternFromString("null");
- }
- Py_INCREF(s_null);
- return s_null;
- }
- else if (obj == Py_True) {
- static PyObject *s_true = NULL;
- if (s_true == NULL) {
- s_true = PyString_InternFromString("true");
- }
- Py_INCREF(s_true);
- return s_true;
- }
- else if (obj == Py_False) {
- static PyObject *s_false = NULL;
- if (s_false == NULL) {
- s_false = PyString_InternFromString("false");
- }
- Py_INCREF(s_false);
- return s_false;
- }
- else {
- PyErr_SetString(PyExc_ValueError, "not a const");
- return NULL;
- }
-}
-
-static PyObject *
-encoder_encode_float(PyEncoderObject *s, PyObject *obj)
-{
- /* Return the JSON representation of a PyFloat */
- double i = PyFloat_AS_DOUBLE(obj);
- if (!Py_IS_FINITE(i)) {
- if (!s->allow_nan) {
- PyErr_SetString(PyExc_ValueError, "Out of range float values are not JSON compliant");
- return NULL;
- }
- if (i > 0) {
- return PyString_FromString("Infinity");
- }
- else if (i < 0) {
- return PyString_FromString("-Infinity");
- }
- else {
- return PyString_FromString("NaN");
- }
- }
- /* Use a better float format here? */
- return PyObject_Repr(obj);
-}
-
-static PyObject *
-encoder_encode_string(PyEncoderObject *s, PyObject *obj)
-{
- /* Return the JSON representation of a string */
- if (s->fast_encode)
- return py_encode_basestring_ascii(NULL, obj);
- else
- return PyObject_CallFunctionObjArgs(s->encoder, obj, NULL);
-}
-
-static int
-_steal_list_append(PyObject *lst, PyObject *stolen)
-{
- /* Append stolen and then decrement its reference count */
- int rval = PyList_Append(lst, stolen);
- Py_DECREF(stolen);
- return rval;
-}
-
-static int
-encoder_listencode_obj(PyEncoderObject *s, PyObject *rval, PyObject *obj, Py_ssize_t indent_level)
-{
- /* Encode Python object obj to a JSON term, rval is a PyList */
- int rv = -1;
- if (Py_EnterRecursiveCall(" while encoding a JSON document"))
- return rv;
- do {
- if (obj == Py_None || obj == Py_True || obj == Py_False) {
- PyObject *cstr = _encoded_const(obj);
- if (cstr != NULL)
- rv = _steal_list_append(rval, cstr);
- }
- else if (PyString_Check(obj) || PyUnicode_Check(obj))
- {
- PyObject *encoded = encoder_encode_string(s, obj);
- if (encoded != NULL)
- rv = _steal_list_append(rval, encoded);
- }
- else if (PyInt_Check(obj) || PyLong_Check(obj)) {
- PyObject *encoded = PyObject_Str(obj);
- if (encoded != NULL)
- rv = _steal_list_append(rval, encoded);
- }
- else if (PyFloat_Check(obj)) {
- PyObject *encoded = encoder_encode_float(s, obj);
- if (encoded != NULL)
- rv = _steal_list_append(rval, encoded);
- }
- else if (PyList_Check(obj) || PyTuple_Check(obj)) {
- rv = encoder_listencode_list(s, rval, obj, indent_level);
- }
- else if (PyDict_Check(obj)) {
- rv = encoder_listencode_dict(s, rval, obj, indent_level);
- }
- else if (s->use_decimal && Decimal_Check(obj)) {
- PyObject *encoded = PyObject_Str(obj);
- if (encoded != NULL)
- rv = _steal_list_append(rval, encoded);
- }
- else {
- PyObject *ident = NULL;
- PyObject *newobj;
- if (s->markers != Py_None) {
- int has_key;
- ident = PyLong_FromVoidPtr(obj);
- if (ident == NULL)
- break;
- has_key = PyDict_Contains(s->markers, ident);
- if (has_key) {
- if (has_key != -1)
- PyErr_SetString(PyExc_ValueError, "Circular reference detected");
- Py_DECREF(ident);
- break;
- }
- if (PyDict_SetItem(s->markers, ident, obj)) {
- Py_DECREF(ident);
- break;
- }
- }
- newobj = PyObject_CallFunctionObjArgs(s->defaultfn, obj, NULL);
- if (newobj == NULL) {
- Py_XDECREF(ident);
- break;
- }
- rv = encoder_listencode_obj(s, rval, newobj, indent_level);
- Py_DECREF(newobj);
- if (rv) {
- Py_XDECREF(ident);
- rv = -1;
- }
- else if (ident != NULL) {
- if (PyDict_DelItem(s->markers, ident)) {
- Py_XDECREF(ident);
- rv = -1;
- }
- Py_XDECREF(ident);
- }
- }
- } while (0);
- Py_LeaveRecursiveCall();
- return rv;
-}
-
-static int
-encoder_listencode_dict(PyEncoderObject *s, PyObject *rval, PyObject *dct, Py_ssize_t indent_level)
-{
- /* Encode Python dict dct a JSON term, rval is a PyList */
- static PyObject *open_dict = NULL;
- static PyObject *close_dict = NULL;
- static PyObject *empty_dict = NULL;
- static PyObject *iteritems = NULL;
- PyObject *kstr = NULL;
- PyObject *ident = NULL;
- PyObject *iter = NULL;
- PyObject *item = NULL;
- PyObject *items = NULL;
- PyObject *encoded = NULL;
- int skipkeys;
- Py_ssize_t idx;
-
- if (open_dict == NULL || close_dict == NULL || empty_dict == NULL || iteritems == NULL) {
- open_dict = PyString_InternFromString("{");
- close_dict = PyString_InternFromString("}");
- empty_dict = PyString_InternFromString("{}");
- iteritems = PyString_InternFromString("iteritems");
- if (open_dict == NULL || close_dict == NULL || empty_dict == NULL || iteritems == NULL)
- return -1;
- }
- if (PyDict_Size(dct) == 0)
- return PyList_Append(rval, empty_dict);
-
- if (s->markers != Py_None) {
- int has_key;
- ident = PyLong_FromVoidPtr(dct);
- if (ident == NULL)
- goto bail;
- has_key = PyDict_Contains(s->markers, ident);
- if (has_key) {
- if (has_key != -1)
- PyErr_SetString(PyExc_ValueError, "Circular reference detected");
- goto bail;
- }
- if (PyDict_SetItem(s->markers, ident, dct)) {
- goto bail;
- }
- }
-
- if (PyList_Append(rval, open_dict))
- goto bail;
-
- if (s->indent != Py_None) {
- /* TODO: DOES NOT RUN */
- indent_level += 1;
- /*
- newline_indent = '\n' + (_indent * _current_indent_level)
- separator = _item_separator + newline_indent
- buf += newline_indent
- */
- }
-
- if (PyObject_IsTrue(s->sort_keys)) {
- /* First sort the keys then replace them with (key, value) tuples. */
- Py_ssize_t i, nitems;
- if (PyDict_CheckExact(dct))
- items = PyDict_Keys(dct);
- else
- items = PyMapping_Keys(dct);
- if (items == NULL)
- goto bail;
- if (!PyList_Check(items)) {
- PyErr_SetString(PyExc_ValueError, "keys must return list");
- goto bail;
- }
- if (PyList_Sort(items) < 0)
- goto bail;
- nitems = PyList_GET_SIZE(items);
- for (i = 0; i < nitems; i++) {
- PyObject *key, *value;
- key = PyList_GET_ITEM(items, i);
- value = PyDict_GetItem(dct, key);
- item = PyTuple_Pack(2, key, value);
- if (item == NULL)
- goto bail;
- PyList_SET_ITEM(items, i, item);
- Py_DECREF(key);
- }
- }
- else {
- if (PyDict_CheckExact(dct))
- items = PyDict_Items(dct);
- else
- items = PyMapping_Items(dct);
- }
- if (items == NULL)
- goto bail;
- iter = PyObject_GetIter(items);
- Py_DECREF(items);
- if (iter == NULL)
- goto bail;
-
- skipkeys = PyObject_IsTrue(s->skipkeys);
- idx = 0;
- while ((item = PyIter_Next(iter))) {
- PyObject *encoded, *key, *value;
- if (!PyTuple_Check(item) || Py_SIZE(item) != 2) {
- PyErr_SetString(PyExc_ValueError, "items must return 2-tuples");
- goto bail;
- }
- key = PyTuple_GET_ITEM(item, 0);
- if (key == NULL)
- goto bail;
- value = PyTuple_GET_ITEM(item, 1);
- if (value == NULL)
- goto bail;
-
- encoded = PyDict_GetItem(s->key_memo, key);
- if (encoded != NULL) {
- Py_INCREF(encoded);
- }
- else if (PyString_Check(key) || PyUnicode_Check(key)) {
- Py_INCREF(key);
- kstr = key;
- }
- else if (PyFloat_Check(key)) {
- kstr = encoder_encode_float(s, key);
- if (kstr == NULL)
- goto bail;
- }
- else if (key == Py_True || key == Py_False || key == Py_None) {
- /* This must come before the PyInt_Check because
- True and False are also 1 and 0.*/
- kstr = _encoded_const(key);
- if (kstr == NULL)
- goto bail;
- }
- else if (PyInt_Check(key) || PyLong_Check(key)) {
- kstr = PyObject_Str(key);
- if (kstr == NULL)
- goto bail;
- }
- else if (skipkeys) {
- Py_DECREF(item);
- continue;
- }
- else {
- /* TODO: include repr of key */
- PyErr_SetString(PyExc_TypeError, "keys must be a string");
- goto bail;
- }
-
- if (idx) {
- if (PyList_Append(rval, s->item_separator))
- goto bail;
- }
-
- if (encoded == NULL) {
- encoded = encoder_encode_string(s, kstr);
- Py_CLEAR(kstr);
- if (encoded == NULL)
- goto bail;
- if (PyDict_SetItem(s->key_memo, key, encoded))
- goto bail;
- }
- if (PyList_Append(rval, encoded)) {
- goto bail;
- }
- Py_CLEAR(encoded);
- if (PyList_Append(rval, s->key_separator))
- goto bail;
- if (encoder_listencode_obj(s, rval, value, indent_level))
- goto bail;
- Py_CLEAR(item);
- idx += 1;
- }
- Py_CLEAR(iter);
- if (PyErr_Occurred())
- goto bail;
- if (ident != NULL) {
- if (PyDict_DelItem(s->markers, ident))
- goto bail;
- Py_CLEAR(ident);
- }
- if (s->indent != Py_None) {
- /* TODO: DOES NOT RUN */
- indent_level -= 1;
- /*
- yield '\n' + (_indent * _current_indent_level)
- */
- }
- if (PyList_Append(rval, close_dict))
- goto bail;
- return 0;
-
-bail:
- Py_XDECREF(encoded);
- Py_XDECREF(items);
- Py_XDECREF(iter);
- Py_XDECREF(kstr);
- Py_XDECREF(ident);
- return -1;
-}
-
-
-static int
-encoder_listencode_list(PyEncoderObject *s, PyObject *rval, PyObject *seq, Py_ssize_t indent_level)
-{
- /* Encode Python list seq to a JSON term, rval is a PyList */
- static PyObject *open_array = NULL;
- static PyObject *close_array = NULL;
- static PyObject *empty_array = NULL;
- PyObject *ident = NULL;
- PyObject *iter = NULL;
- PyObject *obj = NULL;
- int is_true;
- int i = 0;
-
- if (open_array == NULL || close_array == NULL || empty_array == NULL) {
- open_array = PyString_InternFromString("[");
- close_array = PyString_InternFromString("]");
- empty_array = PyString_InternFromString("[]");
- if (open_array == NULL || close_array == NULL || empty_array == NULL)
- return -1;
- }
- ident = NULL;
- is_true = PyObject_IsTrue(seq);
- if (is_true == -1)
- return -1;
- else if (is_true == 0)
- return PyList_Append(rval, empty_array);
-
- if (s->markers != Py_None) {
- int has_key;
- ident = PyLong_FromVoidPtr(seq);
- if (ident == NULL)
- goto bail;
- has_key = PyDict_Contains(s->markers, ident);
- if (has_key) {
- if (has_key != -1)
- PyErr_SetString(PyExc_ValueError, "Circular reference detected");
- goto bail;
- }
- if (PyDict_SetItem(s->markers, ident, seq)) {
- goto bail;
- }
- }
-
- iter = PyObject_GetIter(seq);
- if (iter == NULL)
- goto bail;
-
- if (PyList_Append(rval, open_array))
- goto bail;
- if (s->indent != Py_None) {
- /* TODO: DOES NOT RUN */
- indent_level += 1;
- /*
- newline_indent = '\n' + (_indent * _current_indent_level)
- separator = _item_separator + newline_indent
- buf += newline_indent
- */
- }
- while ((obj = PyIter_Next(iter))) {
- if (i) {
- if (PyList_Append(rval, s->item_separator))
- goto bail;
- }
- if (encoder_listencode_obj(s, rval, obj, indent_level))
- goto bail;
- i++;
- Py_CLEAR(obj);
- }
- Py_CLEAR(iter);
- if (PyErr_Occurred())
- goto bail;
- if (ident != NULL) {
- if (PyDict_DelItem(s->markers, ident))
- goto bail;
- Py_CLEAR(ident);
- }
- if (s->indent != Py_None) {
- /* TODO: DOES NOT RUN */
- indent_level -= 1;
- /*
- yield '\n' + (_indent * _current_indent_level)
- */
- }
- if (PyList_Append(rval, close_array))
- goto bail;
- return 0;
-
-bail:
- Py_XDECREF(obj);
- Py_XDECREF(iter);
- Py_XDECREF(ident);
- return -1;
-}
-
-static void
-encoder_dealloc(PyObject *self)
-{
- /* Deallocate Encoder */
- encoder_clear(self);
- Py_TYPE(self)->tp_free(self);
-}
-
-static int
-encoder_traverse(PyObject *self, visitproc visit, void *arg)
-{
- PyEncoderObject *s;
- assert(PyEncoder_Check(self));
- s = (PyEncoderObject *)self;
- Py_VISIT(s->markers);
- Py_VISIT(s->defaultfn);
- Py_VISIT(s->encoder);
- Py_VISIT(s->indent);
- Py_VISIT(s->key_separator);
- Py_VISIT(s->item_separator);
- Py_VISIT(s->sort_keys);
- Py_VISIT(s->skipkeys);
- Py_VISIT(s->key_memo);
- return 0;
-}
-
-static int
-encoder_clear(PyObject *self)
-{
- /* Deallocate Encoder */
- PyEncoderObject *s;
- assert(PyEncoder_Check(self));
- s = (PyEncoderObject *)self;
- Py_CLEAR(s->markers);
- Py_CLEAR(s->defaultfn);
- Py_CLEAR(s->encoder);
- Py_CLEAR(s->indent);
- Py_CLEAR(s->key_separator);
- Py_CLEAR(s->item_separator);
- Py_CLEAR(s->sort_keys);
- Py_CLEAR(s->skipkeys);
- Py_CLEAR(s->key_memo);
- return 0;
-}
-
-PyDoc_STRVAR(encoder_doc, "_iterencode(obj, _current_indent_level) -> iterable");
-
-static
-PyTypeObject PyEncoderType = {
- PyObject_HEAD_INIT(NULL)
- 0, /* tp_internal */
- "simplejson._speedups.Encoder", /* tp_name */
- sizeof(PyEncoderObject), /* tp_basicsize */
- 0, /* tp_itemsize */
- encoder_dealloc, /* tp_dealloc */
- 0, /* tp_print */
- 0, /* tp_getattr */
- 0, /* tp_setattr */
- 0, /* tp_compare */
- 0, /* tp_repr */
- 0, /* tp_as_number */
- 0, /* tp_as_sequence */
- 0, /* tp_as_mapping */
- 0, /* tp_hash */
- encoder_call, /* tp_call */
- 0, /* tp_str */
- 0, /* tp_getattro */
- 0, /* tp_setattro */
- 0, /* tp_as_buffer */
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags */
- encoder_doc, /* tp_doc */
- encoder_traverse, /* tp_traverse */
- encoder_clear, /* tp_clear */
- 0, /* tp_richcompare */
- 0, /* tp_weaklistoffset */
- 0, /* tp_iter */
- 0, /* tp_iternext */
- 0, /* tp_methods */
- encoder_members, /* tp_members */
- 0, /* tp_getset */
- 0, /* tp_base */
- 0, /* tp_dict */
- 0, /* tp_descr_get */
- 0, /* tp_descr_set */
- 0, /* tp_dictoffset */
- encoder_init, /* tp_init */
- 0, /* tp_alloc */
- encoder_new, /* tp_new */
- 0, /* tp_free */
-};
-
-static PyMethodDef speedups_methods[] = {
- {"encode_basestring_ascii",
- (PyCFunction)py_encode_basestring_ascii,
- METH_O,
- pydoc_encode_basestring_ascii},
- {"scanstring",
- (PyCFunction)py_scanstring,
- METH_VARARGS,
- pydoc_scanstring},
- {NULL, NULL, 0, NULL}
-};
-
-PyDoc_STRVAR(module_doc,
-"simplejson speedups\n");
-
-void
-init_speedups(void)
-{
- PyObject *m, *decimal;
- PyScannerType.tp_new = PyType_GenericNew;
- if (PyType_Ready(&PyScannerType) < 0)
- return;
- PyEncoderType.tp_new = PyType_GenericNew;
- if (PyType_Ready(&PyEncoderType) < 0)
- return;
-
- decimal = PyImport_ImportModule("decimal");
- if (decimal == NULL)
- return;
- DecimalTypePtr = (PyTypeObject*)PyObject_GetAttrString(decimal, "Decimal");
- Py_DECREF(decimal);
- if (DecimalTypePtr == NULL)
- return;
-
- m = Py_InitModule3("_speedups", speedups_methods, module_doc);
- Py_INCREF((PyObject*)&PyScannerType);
- PyModule_AddObject(m, "make_scanner", (PyObject*)&PyScannerType);
- Py_INCREF((PyObject*)&PyEncoderType);
- PyModule_AddObject(m, "make_encoder", (PyObject*)&PyEncoderType);
-}
deleted file mode 100644
--- a/mail/test/resources/simplejson-2.1.6/simplejson/decoder.py
+++ /dev/null
@@ -1,421 +0,0 @@
-"""Implementation of JSONDecoder
-"""
-import re
-import sys
-import struct
-
-from simplejson.scanner import make_scanner
-def _import_c_scanstring():
- try:
- from simplejson._speedups import scanstring
- return scanstring
- except ImportError:
- return None
-c_scanstring = _import_c_scanstring()
-
-__all__ = ['JSONDecoder']
-
-FLAGS = re.VERBOSE | re.MULTILINE | re.DOTALL
-
-def _floatconstants():
- _BYTES = '7FF80000000000007FF0000000000000'.decode('hex')
- # The struct module in Python 2.4 would get frexp() out of range here
- # when an endian is specified in the format string. Fixed in Python 2.5+
- if sys.byteorder != 'big':
- _BYTES = _BYTES[:8][::-1] + _BYTES[8:][::-1]
- nan, inf = struct.unpack('dd', _BYTES)
- return nan, inf, -inf
-
-NaN, PosInf, NegInf = _floatconstants()
-
-
-class JSONDecodeError(ValueError):
- """Subclass of ValueError with the following additional properties:
-
- msg: The unformatted error message
- doc: The JSON document being parsed
- pos: The start index of doc where parsing failed
- end: The end index of doc where parsing failed (may be None)
- lineno: The line corresponding to pos
- colno: The column corresponding to pos
- endlineno: The line corresponding to end (may be None)
- endcolno: The column corresponding to end (may be None)
-
- """
- def __init__(self, msg, doc, pos, end=None):
- ValueError.__init__(self, errmsg(msg, doc, pos, end=end))
- self.msg = msg
- self.doc = doc
- self.pos = pos
- self.end = end
- self.lineno, self.colno = linecol(doc, pos)
- if end is not None:
- self.endlineno, self.endcolno = linecol(doc, end)
- else:
- self.endlineno, self.endcolno = None, None
-
-
-def linecol(doc, pos):
- lineno = doc.count('\n', 0, pos) + 1
- if lineno == 1:
- colno = pos
- else:
- colno = pos - doc.rindex('\n', 0, pos)
- return lineno, colno
-
-
-def errmsg(msg, doc, pos, end=None):
- # Note that this function is called from _speedups
- lineno, colno = linecol(doc, pos)
- if end is None:
- #fmt = '{0}: line {1} column {2} (char {3})'
- #return fmt.format(msg, lineno, colno, pos)
- fmt = '%s: line %d column %d (char %d)'
- return fmt % (msg, lineno, colno, pos)
- endlineno, endcolno = linecol(doc, end)
- #fmt = '{0}: line {1} column {2} - line {3} column {4} (char {5} - {6})'
- #return fmt.format(msg, lineno, colno, endlineno, endcolno, pos, end)
- fmt = '%s: line %d column %d - line %d column %d (char %d - %d)'
- return fmt % (msg, lineno, colno, endlineno, endcolno, pos, end)
-
-
-_CONSTANTS = {
- '-Infinity': NegInf,
- 'Infinity': PosInf,
- 'NaN': NaN,
-}
-
-STRINGCHUNK = re.compile(r'(.*?)(["\\\x00-\x1f])', FLAGS)
-BACKSLASH = {
- '"': u'"', '\\': u'\\', '/': u'/',
- 'b': u'\b', 'f': u'\f', 'n': u'\n', 'r': u'\r', 't': u'\t',
-}
-
-DEFAULT_ENCODING = "utf-8"
-
-def py_scanstring(s, end, encoding=None, strict=True,
- _b=BACKSLASH, _m=STRINGCHUNK.match):
- """Scan the string s for a JSON string. End is the index of the
- character in s after the quote that started the JSON string.
- Unescapes all valid JSON string escape sequences and raises ValueError
- on attempt to decode an invalid string. If strict is False then literal
- control characters are allowed in the string.
-
- Returns a tuple of the decoded string and the index of the character in s
- after the end quote."""
- if encoding is None:
- encoding = DEFAULT_ENCODING
- chunks = []
- _append = chunks.append
- begin = end - 1
- while 1:
- chunk = _m(s, end)
- if chunk is None:
- raise JSONDecodeError(
- "Unterminated string starting at", s, begin)
- end = chunk.end()
- content, terminator = chunk.groups()
- # Content is contains zero or more unescaped string characters
- if content:
- if not isinstance(content, unicode):
- content = unicode(content, encoding)
- _append(content)
- # Terminator is the end of string, a literal control character,
- # or a backslash denoting that an escape sequence follows
- if terminator == '"':
- break
- elif terminator != '\\':
- if strict:
- msg = "Invalid control character %r at" % (terminator,)
- #msg = "Invalid control character {0!r} at".format(terminator)
- raise JSONDecodeError(msg, s, end)
- else:
- _append(terminator)
- continue
- try:
- esc = s[end]
- except IndexError:
- raise JSONDecodeError(
- "Unterminated string starting at", s, begin)
- # If not a unicode escape sequence, must be in the lookup table
- if esc != 'u':
- try:
- char = _b[esc]
- except KeyError:
- msg = "Invalid \\escape: " + repr(esc)
- raise JSONDecodeError(msg, s, end)
- end += 1
- else:
- # Unicode escape sequence
- esc = s[end + 1:end + 5]
- next_end = end + 5
- if len(esc) != 4:
- msg = "Invalid \\uXXXX escape"
- raise JSONDecodeError(msg, s, end)
- uni = int(esc, 16)
- # Check for surrogate pair on UCS-4 systems
- if 0xd800 <= uni <= 0xdbff and sys.maxunicode > 65535:
- msg = "Invalid \\uXXXX\\uXXXX surrogate pair"
- if not s[end + 5:end + 7] == '\\u':
- raise JSONDecodeError(msg, s, end)
- esc2 = s[end + 7:end + 11]
- if len(esc2) != 4:
- raise JSONDecodeError(msg, s, end)
- uni2 = int(esc2, 16)
- uni = 0x10000 + (((uni - 0xd800) << 10) | (uni2 - 0xdc00))
- next_end += 6
- char = unichr(uni)
- end = next_end
- # Append the unescaped character
- _append(char)
- return u''.join(chunks), end
-
-
-# Use speedup if available
-scanstring = c_scanstring or py_scanstring
-
-WHITESPACE = re.compile(r'[ \t\n\r]*', FLAGS)
-WHITESPACE_STR = ' \t\n\r'
-
-def JSONObject((s, end), encoding, strict, scan_once, object_hook,
- object_pairs_hook, memo=None,
- _w=WHITESPACE.match, _ws=WHITESPACE_STR):
- # Backwards compatibility
- if memo is None:
- memo = {}
- memo_get = memo.setdefault
- pairs = []
- # Use a slice to prevent IndexError from being raised, the following
- # check will raise a more specific ValueError if the string is empty
- nextchar = s[end:end + 1]
- # Normally we expect nextchar == '"'
- if nextchar != '"':
- if nextchar in _ws:
- end = _w(s, end).end()
- nextchar = s[end:end + 1]
- # Trivial empty object
- if nextchar == '}':
- if object_pairs_hook is not None:
- result = object_pairs_hook(pairs)
- return result, end + 1
- pairs = {}
- if object_hook is not None:
- pairs = object_hook(pairs)
- return pairs, end + 1
- elif nextchar != '"':
- raise JSONDecodeError("Expecting property name", s, end)
- end += 1
- while True:
- key, end = scanstring(s, end, encoding, strict)
- key = memo_get(key, key)
-
- # To skip some function call overhead we optimize the fast paths where
- # the JSON key separator is ": " or just ":".
- if s[end:end + 1] != ':':
- end = _w(s, end).end()
- if s[end:end + 1] != ':':
- raise JSONDecodeError("Expecting : delimiter", s, end)
-
- end += 1
-
- try:
- if s[end] in _ws:
- end += 1
- if s[end] in _ws:
- end = _w(s, end + 1).end()
- except IndexError:
- pass
-
- try:
- value, end = scan_once(s, end)
- except StopIteration:
- raise JSONDecodeError("Expecting object", s, end)
- pairs.append((key, value))
-
- try:
- nextchar = s[end]
- if nextchar in _ws:
- end = _w(s, end + 1).end()
- nextchar = s[end]
- except IndexError:
- nextchar = ''
- end += 1
-
- if nextchar == '}':
- break
- elif nextchar != ',':
- raise JSONDecodeError("Expecting , delimiter", s, end - 1)
-
- try:
- nextchar = s[end]
- if nextchar in _ws:
- end += 1
- nextchar = s[end]
- if nextchar in _ws:
- end = _w(s, end + 1).end()
- nextchar = s[end]
- except IndexError:
- nextchar = ''
-
- end += 1
- if nextchar != '"':
- raise JSONDecodeError("Expecting property name", s, end - 1)
-
- if object_pairs_hook is not None:
- result = object_pairs_hook(pairs)
- return result, end
- pairs = dict(pairs)
- if object_hook is not None:
- pairs = object_hook(pairs)
- return pairs, end
-
-def JSONArray((s, end), scan_once, _w=WHITESPACE.match, _ws=WHITESPACE_STR):
- values = []
- nextchar = s[end:end + 1]
- if nextchar in _ws:
- end = _w(s, end + 1).end()
- nextchar = s[end:end + 1]
- # Look-ahead for trivial empty array
- if nextchar == ']':
- return values, end + 1
- _append = values.append
- while True:
- try:
- value, end = scan_once(s, end)
- except StopIteration:
- raise JSONDecodeError("Expecting object", s, end)
- _append(value)
- nextchar = s[end:end + 1]
- if nextchar in _ws:
- end = _w(s, end + 1).end()
- nextchar = s[end:end + 1]
- end += 1
- if nextchar == ']':
- break
- elif nextchar != ',':
- raise JSONDecodeError("Expecting , delimiter", s, end)
-
- try:
- if s[end] in _ws:
- end += 1
- if s[end] in _ws:
- end = _w(s, end + 1).end()
- except IndexError:
- pass
-
- return values, end
-
-class JSONDecoder(object):
- """Simple JSON <http://json.org> decoder
-
- Performs the following translations in decoding by default:
-
- +---------------+-------------------+
- | JSON | Python |
- +===============+===================+
- | object | dict |
- +---------------+-------------------+
- | array | list |
- +---------------+-------------------+
- | string | unicode |
- +---------------+-------------------+
- | number (int) | int, long |
- +---------------+-------------------+
- | number (real) | float |
- +---------------+-------------------+
- | true | True |
- +---------------+-------------------+
- | false | False |
- +---------------+-------------------+
- | null | None |
- +---------------+-------------------+
-
- It also understands ``NaN``, ``Infinity``, and ``-Infinity`` as
- their corresponding ``float`` values, which is outside the JSON spec.
-
- """
-
- def __init__(self, encoding=None, object_hook=None, parse_float=None,
- parse_int=None, parse_constant=None, strict=True,
- object_pairs_hook=None):
- """
- *encoding* determines the encoding used to interpret any
- :class:`str` objects decoded by this instance (``'utf-8'`` by
- default). It has no effect when decoding :class:`unicode` objects.
-
- Note that currently only encodings that are a superset of ASCII work,
- strings of other encodings should be passed in as :class:`unicode`.
-
- *object_hook*, if specified, will be called with the result of every
- JSON object decoded and its return value will be used in place of the
- given :class:`dict`. This can be used to provide custom
- deserializations (e.g. to support JSON-RPC class hinting).
-
- *object_pairs_hook* is an optional function that will be called with
- the result of any object literal decode with an ordered list of pairs.
- The return value of *object_pairs_hook* will be used instead of the
- :class:`dict`. This feature can be used to implement custom decoders
- that rely on the order that the key and value pairs are decoded (for
- example, :func:`collections.OrderedDict` will remember the order of
- insertion). If *object_hook* is also defined, the *object_pairs_hook*
- takes priority.
-
- *parse_float*, if specified, will be called with the string of every
- JSON float to be decoded. By default, this is equivalent to
- ``float(num_str)``. This can be used to use another datatype or parser
- for JSON floats (e.g. :class:`decimal.Decimal`).
-
- *parse_int*, if specified, will be called with the string of every
- JSON int to be decoded. By default, this is equivalent to
- ``int(num_str)``. This can be used to use another datatype or parser
- for JSON integers (e.g. :class:`float`).
-
- *parse_constant*, if specified, will be called with one of the
- following strings: ``'-Infinity'``, ``'Infinity'``, ``'NaN'``. This
- can be used to raise an exception if invalid JSON numbers are
- encountered.
-
- *strict* controls the parser's behavior when it encounters an
- invalid control character in a string. The default setting of
- ``True`` means that unescaped control characters are parse errors, if
- ``False`` then control characters will be allowed in strings.
-
- """
- self.encoding = encoding
- self.object_hook = object_hook
- self.object_pairs_hook = object_pairs_hook
- self.parse_float = parse_float or float
- self.parse_int = parse_int or int
- self.parse_constant = parse_constant or _CONSTANTS.__getitem__
- self.strict = strict
- self.parse_object = JSONObject
- self.parse_array = JSONArray
- self.parse_string = scanstring
- self.memo = {}
- self.scan_once = make_scanner(self)
-
- def decode(self, s, _w=WHITESPACE.match):
- """Return the Python representation of ``s`` (a ``str`` or ``unicode``
- instance containing a JSON document)
-
- """
- obj, end = self.raw_decode(s, idx=_w(s, 0).end())
- end = _w(s, end).end()
- if end != len(s):
- raise JSONDecodeError("Extra data", s, end, len(s))
- return obj
-
- def raw_decode(self, s, idx=0):
- """Decode a JSON document from ``s`` (a ``str`` or ``unicode``
- beginning with a JSON document) and return a 2-tuple of the Python
- representation and the index in ``s`` where the document ended.
-
- This can be used to decode a JSON document from a string that may
- have extraneous data at the end.
-
- """
- try:
- obj, end = self.scan_once(s, idx)
- except StopIteration:
- raise JSONDecodeError("No JSON object could be decoded", s, idx)
- return obj, end
deleted file mode 100644
--- a/mail/test/resources/simplejson-2.1.6/simplejson/encoder.py
+++ /dev/null
@@ -1,503 +0,0 @@
-"""Implementation of JSONEncoder
-"""
-import re
-from decimal import Decimal
-
-def _import_speedups():
- try:
- from simplejson import _speedups
- return _speedups.encode_basestring_ascii, _speedups.make_encoder
- except ImportError:
- return None, None
-c_encode_basestring_ascii, c_make_encoder = _import_speedups()
-
-from simplejson.decoder import PosInf
-
-ESCAPE = re.compile(r'[\x00-\x1f\\"\b\f\n\r\t]')
-ESCAPE_ASCII = re.compile(r'([\\"]|[^\ -~])')
-HAS_UTF8 = re.compile(r'[\x80-\xff]')
-ESCAPE_DCT = {
- '\\': '\\\\',
- '"': '\\"',
- '\b': '\\b',
- '\f': '\\f',
- '\n': '\\n',
- '\r': '\\r',
- '\t': '\\t',
-}
-for i in range(0x20):
- #ESCAPE_DCT.setdefault(chr(i), '\\u{0:04x}'.format(i))
- ESCAPE_DCT.setdefault(chr(i), '\\u%04x' % (i,))
-
-FLOAT_REPR = repr
-
-def encode_basestring(s):
- """Return a JSON representation of a Python string
-
- """
- if isinstance(s, str) and HAS_UTF8.search(s) is not None:
- s = s.decode('utf-8')
- def replace(match):
- return ESCAPE_DCT[match.group(0)]
- return u'"' + ESCAPE.sub(replace, s) + u'"'
-
-
-def py_encode_basestring_ascii(s):
- """Return an ASCII-only JSON representation of a Python string
-
- """
- if isinstance(s, str) and HAS_UTF8.search(s) is not None:
- s = s.decode('utf-8')
- def replace(match):
- s = match.group(0)
- try:
- return ESCAPE_DCT[s]
- except KeyError:
- n = ord(s)
- if n < 0x10000:
- #return '\\u{0:04x}'.format(n)
- return '\\u%04x' % (n,)
- else:
- # surrogate pair
- n -= 0x10000
- s1 = 0xd800 | ((n >> 10) & 0x3ff)
- s2 = 0xdc00 | (n & 0x3ff)
- #return '\\u{0:04x}\\u{1:04x}'.format(s1, s2)
- return '\\u%04x\\u%04x' % (s1, s2)
- return '"' + str(ESCAPE_ASCII.sub(replace, s)) + '"'
-
-
-encode_basestring_ascii = (
- c_encode_basestring_ascii or py_encode_basestring_ascii)
-
-class JSONEncoder(object):
- """Extensible JSON <http://json.org> encoder for Python data structures.
-
- Supports the following objects and types by default:
-
- +-------------------+---------------+
- | Python | JSON |
- +===================+===============+
- | dict | object |
- +-------------------+---------------+
- | list, tuple | array |
- +-------------------+---------------+
- | str, unicode | string |
- +-------------------+---------------+
- | int, long, float | number |
- +-------------------+---------------+
- | True | true |
- +-------------------+---------------+
- | False | false |
- +-------------------+---------------+
- | None | null |
- +-------------------+---------------+
-
- To extend this to recognize other objects, subclass and implement a
- ``.default()`` method with another method that returns a serializable
- object for ``o`` if possible, otherwise it should call the superclass
- implementation (to raise ``TypeError``).
-
- """
- item_separator = ', '
- key_separator = ': '
- def __init__(self, skipkeys=False, ensure_ascii=True,
- check_circular=True, allow_nan=True, sort_keys=False,
- indent=None, separators=None, encoding='utf-8', default=None,
- use_decimal=False):
- """Constructor for JSONEncoder, with sensible defaults.
-
- If skipkeys is false, then it is a TypeError to attempt
- encoding of keys that are not str, int, long, float or None. If
- skipkeys is True, such items are simply skipped.
-
- If ensure_ascii is true, the output is guaranteed to be str
- objects with all incoming unicode characters escaped. If
- ensure_ascii is false, the output will be unicode object.
-
- If check_circular is true, then lists, dicts, and custom encoded
- objects will be checked for circular references during encoding to
- prevent an infinite recursion (which would cause an OverflowError).
- Otherwise, no such check takes place.
-
- If allow_nan is true, then NaN, Infinity, and -Infinity will be
- encoded as such. This behavior is not JSON specification compliant,
- but is consistent with most JavaScript based encoders and decoders.
- Otherwise, it will be a ValueError to encode such floats.
-
- If sort_keys is true, then the output of dictionaries will be
- sorted by key; this is useful for regression tests to ensure
- that JSON serializations can be compared on a day-to-day basis.
-
- If indent is a string, then JSON array elements and object members
- will be pretty-printed with a newline followed by that string repeated
- for each level of nesting. ``None`` (the default) selects the most compact
- representation without any newlines. For backwards compatibility with
- versions of simplejson earlier than 2.1.0, an integer is also accepted
- and is converted to a string with that many spaces.
-
- If specified, separators should be a (item_separator, key_separator)
- tuple. The default is (', ', ': '). To get the most compact JSON
- representation you should specify (',', ':') to eliminate whitespace.
-
- If specified, default is a function that gets called for objects
- that can't otherwise be serialized. It should return a JSON encodable
- version of the object or raise a ``TypeError``.
-
- If encoding is not None, then all input strings will be
- transformed into unicode using that encoding prior to JSON-encoding.
- The default is UTF-8.
-
- If use_decimal is true (not the default), ``decimal.Decimal`` will
- be supported directly by the encoder. For the inverse, decode JSON
- with ``parse_float=decimal.Decimal``.
-
- """
-
- self.skipkeys = skipkeys
- self.ensure_ascii = ensure_ascii
- self.check_circular = check_circular
- self.allow_nan = allow_nan
- self.sort_keys = sort_keys
- self.use_decimal = use_decimal
- if isinstance(indent, (int, long)):
- indent = ' ' * indent
- self.indent = indent
- if separators is not None:
- self.item_separator, self.key_separator = separators
- elif indent is not None:
- self.item_separator = ','
- if default is not None:
- self.default = default
- self.encoding = encoding
-
- def default(self, o):
- """Implement this method in a subclass such that it returns
- a serializable object for ``o``, or calls the base implementation
- (to raise a ``TypeError``).
-
- For example, to support arbitrary iterators, you could
- implement default like this::
-
- def default(self, o):
- try:
- iterable = iter(o)
- except TypeError:
- pass
- else:
- return list(iterable)
- return JSONEncoder.default(self, o)
-
- """
- raise TypeError(repr(o) + " is not JSON serializable")
-
- def encode(self, o):
- """Return a JSON string representation of a Python data structure.
-
- >>> from simplejson import JSONEncoder
- >>> JSONEncoder().encode({"foo": ["bar", "baz"]})
- '{"foo": ["bar", "baz"]}'
-
- """
- # This is for extremely simple cases and benchmarks.
- if isinstance(o, basestring):
- if isinstance(o, str):
- _encoding = self.encoding
- if (_encoding is not None
- and not (_encoding == 'utf-8')):
- o = o.decode(_encoding)
- if self.ensure_ascii:
- return encode_basestring_ascii(o)
- else:
- return encode_basestring(o)
- # This doesn't pass the iterator directly to ''.join() because the
- # exceptions aren't as detailed. The list call should be roughly
- # equivalent to the PySequence_Fast that ''.join() would do.
- chunks = self.iterencode(o, _one_shot=True)
- if not isinstance(chunks, (list, tuple)):
- chunks = list(chunks)
- if self.ensure_ascii:
- return ''.join(chunks)
- else:
- return u''.join(chunks)
-
- def iterencode(self, o, _one_shot=False):
- """Encode the given object and yield each string
- representation as available.
-
- For example::
-
- for chunk in JSONEncoder().iterencode(bigobject):
- mysocket.write(chunk)
-
- """
- if self.check_circular:
- markers = {}
- else:
- markers = None
- if self.ensure_ascii:
- _encoder = encode_basestring_ascii
- else:
- _encoder = encode_basestring
- if self.encoding != 'utf-8':
- def _encoder(o, _orig_encoder=_encoder, _encoding=self.encoding):
- if isinstance(o, str):
- o = o.decode(_encoding)
- return _orig_encoder(o)
-
- def floatstr(o, allow_nan=self.allow_nan,
- _repr=FLOAT_REPR, _inf=PosInf, _neginf=-PosInf):
- # Check for specials. Note that this type of test is processor
- # and/or platform-specific, so do tests which don't depend on
- # the internals.
-
- if o != o:
- text = 'NaN'
- elif o == _inf:
- text = 'Infinity'
- elif o == _neginf:
- text = '-Infinity'
- else:
- return _repr(o)
-
- if not allow_nan:
- raise ValueError(
- "Out of range float values are not JSON compliant: " +
- repr(o))
-
- return text
-
-
- key_memo = {}
- if (_one_shot and c_make_encoder is not None
- and self.indent is None):
- _iterencode = c_make_encoder(
- markers, self.default, _encoder, self.indent,
- self.key_separator, self.item_separator, self.sort_keys,
- self.skipkeys, self.allow_nan, key_memo, self.use_decimal)
- else:
- _iterencode = _make_iterencode(
- markers, self.default, _encoder, self.indent, floatstr,
- self.key_separator, self.item_separator, self.sort_keys,
- self.skipkeys, _one_shot, self.use_decimal)
- try:
- return _iterencode(o, 0)
- finally:
- key_memo.clear()
-
-
-class JSONEncoderForHTML(JSONEncoder):
- """An encoder that produces JSON safe to embed in HTML.
-
- To embed JSON content in, say, a script tag on a web page, the
- characters &, < and > should be escaped. They cannot be escaped
- with the usual entities (e.g. &) because they are not expanded
- within <script> tags.
- """
-
- def encode(self, o):
- # Override JSONEncoder.encode because it has hacks for
- # performance that make things more complicated.
- chunks = self.iterencode(o, True)
- if self.ensure_ascii:
- return ''.join(chunks)
- else:
- return u''.join(chunks)
-
- def iterencode(self, o, _one_shot=False):
- chunks = super(JSONEncoderForHTML, self).iterencode(o, _one_shot)
- for chunk in chunks:
- chunk = chunk.replace('&', '\\u0026')
- chunk = chunk.replace('<', '\\u003c')
- chunk = chunk.replace('>', '\\u003e')
- yield chunk
-
-
-def _make_iterencode(markers, _default, _encoder, _indent, _floatstr,
- _key_separator, _item_separator, _sort_keys, _skipkeys, _one_shot,
- _use_decimal,
- ## HACK: hand-optimized bytecode; turn globals into locals
- False=False,
- True=True,
- ValueError=ValueError,
- basestring=basestring,
- Decimal=Decimal,
- dict=dict,
- float=float,
- id=id,
- int=int,
- isinstance=isinstance,
- list=list,
- long=long,
- str=str,
- tuple=tuple,
- ):
-
- def _iterencode_list(lst, _current_indent_level):
- if not lst:
- yield '[]'
- return
- if markers is not None:
- markerid = id(lst)
- if markerid in markers:
- raise ValueError("Circular reference detected")
- markers[markerid] = lst
- buf = '['
- if _indent is not None:
- _current_indent_level += 1
- newline_indent = '\n' + (_indent * _current_indent_level)
- separator = _item_separator + newline_indent
- buf += newline_indent
- else:
- newline_indent = None
- separator = _item_separator
- first = True
- for value in lst:
- if first:
- first = False
- else:
- buf = separator
- if isinstance(value, basestring):
- yield buf + _encoder(value)
- elif value is None:
- yield buf + 'null'
- elif value is True:
- yield buf + 'true'
- elif value is False:
- yield buf + 'false'
- elif isinstance(value, (int, long)):
- yield buf + str(value)
- elif isinstance(value, float):
- yield buf + _floatstr(value)
- elif _use_decimal and isinstance(value, Decimal):
- yield buf + str(value)
- else:
- yield buf
- if isinstance(value, (list, tuple)):
- chunks = _iterencode_list(value, _current_indent_level)
- elif isinstance(value, dict):
- chunks = _iterencode_dict(value, _current_indent_level)
- else:
- chunks = _iterencode(value, _current_indent_level)
- for chunk in chunks:
- yield chunk
- if newline_indent is not None:
- _current_indent_level -= 1
- yield '\n' + (_indent * _current_indent_level)
- yield ']'
- if markers is not None:
- del markers[markerid]
-
- def _iterencode_dict(dct, _current_indent_level):
- if not dct:
- yield '{}'
- return
- if markers is not None:
- markerid = id(dct)
- if markerid in markers:
- raise ValueError("Circular reference detected")
- markers[markerid] = dct
- yield '{'
- if _indent is not None:
- _current_indent_level += 1
- newline_indent = '\n' + (_indent * _current_indent_level)
- item_separator = _item_separator + newline_indent
- yield newline_indent
- else:
- newline_indent = None
- item_separator = _item_separator
- first = True
- if _sort_keys:
- items = dct.items()
- items.sort(key=lambda kv: kv[0])
- else:
- items = dct.iteritems()
- for key, value in items:
- if isinstance(key, basestring):
- pass
- # JavaScript is weakly typed for these, so it makes sense to
- # also allow them. Many encoders seem to do something like this.
- elif isinstance(key, float):
- key = _floatstr(key)
- elif key is True:
- key = 'true'
- elif key is False:
- key = 'false'
- elif key is None:
- key = 'null'
- elif isinstance(key, (int, long)):
- key = str(key)
- elif _skipkeys:
- continue
- else:
- raise TypeError("key " + repr(key) + " is not a string")
- if first:
- first = False
- else:
- yield item_separator
- yield _encoder(key)
- yield _key_separator
- if isinstance(value, basestring):
- yield _encoder(value)
- elif value is None:
- yield 'null'
- elif value is True:
- yield 'true'
- elif value is False:
- yield 'false'
- elif isinstance(value, (int, long)):
- yield str(value)
- elif isinstance(value, float):
- yield _floatstr(value)
- elif _use_decimal and isinstance(value, Decimal):
- yield str(value)
- else:
- if isinstance(value, (list, tuple)):
- chunks = _iterencode_list(value, _current_indent_level)
- elif isinstance(value, dict):
- chunks = _iterencode_dict(value, _current_indent_level)
- else:
- chunks = _iterencode(value, _current_indent_level)
- for chunk in chunks:
- yield chunk
- if newline_indent is not None:
- _current_indent_level -= 1
- yield '\n' + (_indent * _current_indent_level)
- yield '}'
- if markers is not None:
- del markers[markerid]
-
- def _iterencode(o, _current_indent_level):
- if isinstance(o, basestring):
- yield _encoder(o)
- elif o is None:
- yield 'null'
- elif o is True:
- yield 'true'
- elif o is False:
- yield 'false'
- elif isinstance(o, (int, long)):
- yield str(o)
- elif isinstance(o, float):
- yield _floatstr(o)
- elif isinstance(o, (list, tuple)):
- for chunk in _iterencode_list(o, _current_indent_level):
- yield chunk
- elif isinstance(o, dict):
- for chunk in _iterencode_dict(o, _current_indent_level):
- yield chunk
- elif _use_decimal and isinstance(o, Decimal):
- yield str(o)
- else:
- if markers is not None:
- markerid = id(o)
- if markerid in markers:
- raise ValueError("Circular reference detected")
- markers[markerid] = o
- o = _default(o)
- for chunk in _iterencode(o, _current_indent_level):
- yield chunk
- if markers is not None:
- del markers[markerid]
-
- return _iterencode
deleted file mode 100644
--- a/mail/test/resources/simplejson-2.1.6/simplejson/ordered_dict.py
+++ /dev/null
@@ -1,119 +0,0 @@
-"""Drop-in replacement for collections.OrderedDict by Raymond Hettinger
-
-http://code.activestate.com/recipes/576693/
-
-"""
-from UserDict import DictMixin
-
-# Modified from original to support Python 2.4, see
-# http://code.google.com/p/simplejson/issues/detail?id=53
-try:
- all
-except NameError:
- def all(seq):
- for elem in seq:
- if not elem:
- return False
- return True
-
-class OrderedDict(dict, DictMixin):
-
- def __init__(self, *args, **kwds):
- if len(args) > 1:
- raise TypeError('expected at most 1 arguments, got %d' % len(args))
- try:
- self.__end
- except AttributeError:
- self.clear()
- self.update(*args, **kwds)
-
- def clear(self):
- self.__end = end = []
- end += [None, end, end] # sentinel node for doubly linked list
- self.__map = {} # key --> [key, prev, next]
- dict.clear(self)
-
- def __setitem__(self, key, value):
- if key not in self:
- end = self.__end
- curr = end[1]
- curr[2] = end[1] = self.__map[key] = [key, curr, end]
- dict.__setitem__(self, key, value)
-
- def __delitem__(self, key):
- dict.__delitem__(self, key)
- key, prev, next = self.__map.pop(key)
- prev[2] = next
- next[1] = prev
-
- def __iter__(self):
- end = self.__end
- curr = end[2]
- while curr is not end:
- yield curr[0]
- curr = curr[2]
-
- def __reversed__(self):
- end = self.__end
- curr = end[1]
- while curr is not end:
- yield curr[0]
- curr = curr[1]
-
- def popitem(self, last=True):
- if not self:
- raise KeyError('dictionary is empty')
- # Modified from original to support Python 2.4, see
- # http://code.google.com/p/simplejson/issues/detail?id=53
- if last:
- key = reversed(self).next()
- else:
- key = iter(self).next()
- value = self.pop(key)
- return key, value
-
- def __reduce__(self):
- items = [[k, self[k]] for k in self]
- tmp = self.__map, self.__end
- del self.__map, self.__end
- inst_dict = vars(self).copy()
- self.__map, self.__end = tmp
- if inst_dict:
- return (self.__class__, (items,), inst_dict)
- return self.__class__, (items,)
-
- def keys(self):
- return list(self)
-
- setdefault = DictMixin.setdefault
- update = DictMixin.update
- pop = DictMixin.pop
- values = DictMixin.values
- items = DictMixin.items
- iterkeys = DictMixin.iterkeys
- itervalues = DictMixin.itervalues
- iteritems = DictMixin.iteritems
-
- def __repr__(self):
- if not self:
- return '%s()' % (self.__class__.__name__,)
- return '%s(%r)' % (self.__class__.__name__, self.items())
-
- def copy(self):
- return self.__class__(self)
-
- @classmethod
- def fromkeys(cls, iterable, value=None):
- d = cls()
- for key in iterable:
- d[key] = value
- return d
-
- def __eq__(self, other):
- if isinstance(other, OrderedDict):
- return len(self)==len(other) and \
- all(p==q for p, q in zip(self.items(), other.items()))
- return dict.__eq__(self, other)
-
- def __ne__(self, other):
- return not self == other
deleted file mode 100644
--- a/mail/test/resources/simplejson-2.1.6/simplejson/scanner.py
+++ /dev/null
@@ -1,77 +0,0 @@
-"""JSON token scanner
-"""
-import re
-def _import_c_make_scanner():
- try:
- from simplejson._speedups import make_scanner
- return make_scanner
- except ImportError:
- return None
-c_make_scanner = _import_c_make_scanner()
-
-__all__ = ['make_scanner']
-
-NUMBER_RE = re.compile(
- r'(-?(?:0|[1-9]\d*))(\.\d+)?([eE][-+]?\d+)?',
- (re.VERBOSE | re.MULTILINE | re.DOTALL))
-
-def py_make_scanner(context):
- parse_object = context.parse_object
- parse_array = context.parse_array
- parse_string = context.parse_string
- match_number = NUMBER_RE.match
- encoding = context.encoding
- strict = context.strict
- parse_float = context.parse_float
- parse_int = context.parse_int
- parse_constant = context.parse_constant
- object_hook = context.object_hook
- object_pairs_hook = context.object_pairs_hook
- memo = context.memo
-
- def _scan_once(string, idx):
- try:
- nextchar = string[idx]
- except IndexError:
- raise StopIteration
-
- if nextchar == '"':
- return parse_string(string, idx + 1, encoding, strict)
- elif nextchar == '{':
- return parse_object((string, idx + 1), encoding, strict,
- _scan_once, object_hook, object_pairs_hook, memo)
- elif nextchar == '[':
- return parse_array((string, idx + 1), _scan_once)
- elif nextchar == 'n' and string[idx:idx + 4] == 'null':
- return None, idx + 4
- elif nextchar == 't' and string[idx:idx + 4] == 'true':
- return True, idx + 4
- elif nextchar == 'f' and string[idx:idx + 5] == 'false':
- return False, idx + 5
-
- m = match_number(string, idx)
- if m is not None:
- integer, frac, exp = m.groups()
- if frac or exp:
- res = parse_float(integer + (frac or '') + (exp or ''))
- else:
- res = parse_int(integer)
- return res, m.end()
- elif nextchar == 'N' and string[idx:idx + 3] == 'NaN':
- return parse_constant('NaN'), idx + 3
- elif nextchar == 'I' and string[idx:idx + 8] == 'Infinity':
- return parse_constant('Infinity'), idx + 8
- elif nextchar == '-' and string[idx:idx + 9] == '-Infinity':
- return parse_constant('-Infinity'), idx + 9
- else:
- raise StopIteration
-
- def scan_once(string, idx):
- try:
- return _scan_once(string, idx)
- finally:
- memo.clear()
-
- return scan_once
-
-make_scanner = c_make_scanner or py_make_scanner
deleted file mode 100644
--- a/mail/test/resources/simplejson-2.1.6/simplejson/tests/__init__.py
+++ /dev/null
@@ -1,64 +0,0 @@
-import unittest
-import doctest
-
-
-class OptionalExtensionTestSuite(unittest.TestSuite):
- def run(self, result):
- import simplejson
- run = unittest.TestSuite.run
- run(self, result)
- simplejson._toggle_speedups(False)
- run(self, result)
- simplejson._toggle_speedups(True)
- return result
-
-
-def additional_tests(suite=None):
- import simplejson
- import simplejson.encoder
- import simplejson.decoder
- if suite is None:
- suite = unittest.TestSuite()
- for mod in (simplejson, simplejson.encoder, simplejson.decoder):
- suite.addTest(doctest.DocTestSuite(mod))
- suite.addTest(doctest.DocFileSuite('../../index.rst'))
- return suite
-
-
-def all_tests_suite():
- suite = unittest.TestLoader().loadTestsFromNames([
- 'simplejson.tests.test_check_circular',
- 'simplejson.tests.test_decode',
- 'simplejson.tests.test_default',
- 'simplejson.tests.test_dump',
- 'simplejson.tests.test_encode_basestring_ascii',
- 'simplejson.tests.test_encode_for_html',
- 'simplejson.tests.test_errors',
- 'simplejson.tests.test_fail',
- 'simplejson.tests.test_float',
- 'simplejson.tests.test_indent',
- 'simplejson.tests.test_pass1',
- 'simplejson.tests.test_pass2',
- 'simplejson.tests.test_pass3',
- 'simplejson.tests.test_recursion',
- 'simplejson.tests.test_scanstring',
- 'simplejson.tests.test_separators',
- 'simplejson.tests.test_speedups',
- 'simplejson.tests.test_unicode',
- 'simplejson.tests.test_decimal',
- ])
- suite = additional_tests(suite)
- return OptionalExtensionTestSuite([suite])
-
-
-def main():
- runner = unittest.TextTestRunner()
- suite = all_tests_suite()
- runner.run(suite)
-
-
-if __name__ == '__main__':
- import os
- import sys
- sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
- main()
deleted file mode 100644
--- a/mail/test/resources/simplejson-2.1.6/simplejson/tests/test_check_circular.py
+++ /dev/null
@@ -1,30 +0,0 @@
-from unittest import TestCase
-import simplejson as json
-
-def default_iterable(obj):
- return list(obj)
-
-class TestCheckCircular(TestCase):
- def test_circular_dict(self):
- dct = {}
- dct['a'] = dct
- self.assertRaises(ValueError, json.dumps, dct)
-
- def test_circular_list(self):
- lst = []
- lst.append(lst)
- self.assertRaises(ValueError, json.dumps, lst)
-
- def test_circular_composite(self):
- dct2 = {}
- dct2['a'] = []
- dct2['a'].append(dct2)
- self.assertRaises(ValueError, json.dumps, dct2)
-
- def test_circular_default(self):
- json.dumps([set()], default=default_iterable)
- self.assertRaises(TypeError, json.dumps, [set()])
-
- def test_circular_off_default(self):
- json.dumps([set()], default=default_iterable, check_circular=False)
- self.assertRaises(TypeError, json.dumps, [set()], check_circular=False)
deleted file mode 100644
--- a/mail/test/resources/simplejson-2.1.6/simplejson/tests/test_decimal.py
+++ /dev/null
@@ -1,50 +0,0 @@
-from decimal import Decimal
-from unittest import TestCase
-from StringIO import StringIO
-
-import simplejson as json
-
-class TestDecimal(TestCase):
- NUMS = "1.0", "10.00", "1.1", "1234567890.1234567890", "500"
- def dumps(self, obj, **kw):
- sio = StringIO()
- json.dump(obj, sio, **kw)
- res = json.dumps(obj, **kw)
- self.assertEquals(res, sio.getvalue())
- return res
-
- def loads(self, s, **kw):
- sio = StringIO(s)
- res = json.loads(s, **kw)
- self.assertEquals(res, json.load(sio, **kw))
- return res
-
- def test_decimal_encode(self):
- for d in map(Decimal, self.NUMS):
- self.assertEquals(self.dumps(d, use_decimal=True), str(d))
-
- def test_decimal_decode(self):
- for s in self.NUMS:
- self.assertEquals(self.loads(s, parse_float=Decimal), Decimal(s))
-
- def test_decimal_roundtrip(self):
- for d in map(Decimal, self.NUMS):
- # The type might not be the same (int and Decimal) but they
- # should still compare equal.
- self.assertEquals(
- self.loads(
- self.dumps(d, use_decimal=True), parse_float=Decimal),
- d)
- self.assertEquals(
- self.loads(
- self.dumps([d], use_decimal=True), parse_float=Decimal),
- [d])
-
- def test_decimal_defaults(self):
- d = Decimal(1)
- sio = StringIO()
- # use_decimal=False is the default
- self.assertRaises(TypeError, json.dumps, d, use_decimal=False)
- self.assertRaises(TypeError, json.dumps, d)
- self.assertRaises(TypeError, json.dump, d, sio, use_decimal=False)
- self.assertRaises(TypeError, json.dump, d, sio)
\ No newline at end of file
deleted file mode 100644
--- a/mail/test/resources/simplejson-2.1.6/simplejson/tests/test_decode.py
+++ /dev/null
@@ -1,83 +0,0 @@
-import decimal
-from unittest import TestCase
-from StringIO import StringIO
-
-import simplejson as json
-from simplejson import OrderedDict
-
-class TestDecode(TestCase):
- if not hasattr(TestCase, 'assertIs'):
- def assertIs(self, a, b):
- self.assertTrue(a is b, '%r is %r' % (a, b))
-
- def test_decimal(self):
- rval = json.loads('1.1', parse_float=decimal.Decimal)
- self.assertTrue(isinstance(rval, decimal.Decimal))
- self.assertEquals(rval, decimal.Decimal('1.1'))
-
- def test_float(self):
- rval = json.loads('1', parse_int=float)
- self.assertTrue(isinstance(rval, float))
- self.assertEquals(rval, 1.0)
-
- def test_decoder_optimizations(self):
- # Several optimizations were made that skip over calls to
- # the whitespace regex, so this test is designed to try and
- # exercise the uncommon cases. The array cases are already covered.
- rval = json.loads('{ "key" : "value" , "k":"v" }')
- self.assertEquals(rval, {"key":"value", "k":"v"})
-
- def test_empty_objects(self):
- s = '{}'
- self.assertEqual(json.loads(s), eval(s))
- s = '[]'
- self.assertEqual(json.loads(s), eval(s))
- s = '""'
- self.assertEqual(json.loads(s), eval(s))
-
- def test_object_pairs_hook(self):
- s = '{"xkd":1, "kcw":2, "art":3, "hxm":4, "qrt":5, "pad":6, "hoy":7}'
- p = [("xkd", 1), ("kcw", 2), ("art", 3), ("hxm", 4),
- ("qrt", 5), ("pad", 6), ("hoy", 7)]
- self.assertEqual(json.loads(s), eval(s))
- self.assertEqual(json.loads(s, object_pairs_hook=lambda x: x), p)
- self.assertEqual(json.load(StringIO(s),
- object_pairs_hook=lambda x: x), p)
- od = json.loads(s, object_pairs_hook=OrderedDict)
- self.assertEqual(od, OrderedDict(p))
- self.assertEqual(type(od), OrderedDict)
- # the object_pairs_hook takes priority over the object_hook
- self.assertEqual(json.loads(s,
- object_pairs_hook=OrderedDict,
- object_hook=lambda x: None),
- OrderedDict(p))
-
- def check_keys_reuse(self, source, loads):
- rval = loads(source)
- (a, b), (c, d) = sorted(rval[0]), sorted(rval[1])
- self.assertIs(a, c)
- self.assertIs(b, d)
-
- def test_keys_reuse_str(self):
- s = u'[{"a_key": 1, "b_\xe9": 2}, {"a_key": 3, "b_\xe9": 4}]'.encode('utf8')
- self.check_keys_reuse(s, json.loads)
-
- def test_keys_reuse_unicode(self):
- s = u'[{"a_key": 1, "b_\xe9": 2}, {"a_key": 3, "b_\xe9": 4}]'
- self.check_keys_reuse(s, json.loads)
-
- def test_empty_strings(self):
- self.assertEqual(json.loads('""'), "")
- self.assertEqual(json.loads(u'""'), u"")
- self.assertEqual(json.loads('[""]'), [""])
- self.assertEqual(json.loads(u'[""]'), [u""])
-
- def test_raw_decode(self):
- cls = json.decoder.JSONDecoder
- self.assertEqual(
- ({'a': {}}, 9),
- cls().raw_decode("{\"a\": {}}"))
- # http://code.google.com/p/simplejson/issues/detail?id=85
- self.assertEqual(
- ({'a': {}}, 9),
- cls(object_pairs_hook=dict).raw_decode("{\"a\": {}}"))
deleted file mode 100644
--- a/mail/test/resources/simplejson-2.1.6/simplejson/tests/test_default.py
+++ /dev/null
@@ -1,9 +0,0 @@
-from unittest import TestCase
-
-import simplejson as json
-
-class TestDefault(TestCase):
- def test_default(self):
- self.assertEquals(
- json.dumps(type, default=repr),
- json.dumps(repr(type)))
deleted file mode 100644
--- a/mail/test/resources/simplejson-2.1.6/simplejson/tests/test_dump.py
+++ /dev/null
@@ -1,27 +0,0 @@
-from unittest import TestCase
-from cStringIO import StringIO
-
-import simplejson as json
-
-class TestDump(TestCase):
- def test_dump(self):
- sio = StringIO()
- json.dump({}, sio)
- self.assertEquals(sio.getvalue(), '{}')
-
- def test_dumps(self):
- self.assertEquals(json.dumps({}), '{}')
-
- def test_encode_truefalse(self):
- self.assertEquals(json.dumps(
- {True: False, False: True}, sort_keys=True),
- '{"false": true, "true": false}')
- self.assertEquals(json.dumps(
- {2: 3.0, 4.0: 5L, False: 1, 6L: True, "7": 0}, sort_keys=True),
- '{"false": 1, "2": 3.0, "4.0": 5, "6": true, "7": 0}')
-
- def test_ordered_dict(self):
- # http://bugs.python.org/issue6105
- items = [('one', 1), ('two', 2), ('three', 3), ('four', 4), ('five', 5)]
- s = json.dumps(json.OrderedDict(items))
- self.assertEqual(s, '{"one": 1, "two": 2, "three": 3, "four": 4, "five": 5}')
\ No newline at end of file
deleted file mode 100644
--- a/mail/test/resources/simplejson-2.1.6/simplejson/tests/test_encode_basestring_ascii.py
+++ /dev/null
@@ -1,46 +0,0 @@
-from unittest import TestCase
-
-import simplejson.encoder
-
-CASES = [
- (u'/\\"\ucafe\ubabe\uab98\ufcde\ubcda\uef4a\x08\x0c\n\r\t`1~!@#$%^&*()_+-=[]{}|;:\',./<>?', '"/\\\\\\"\\ucafe\\ubabe\\uab98\\ufcde\\ubcda\\uef4a\\b\\f\\n\\r\\t`1~!@#$%^&*()_+-=[]{}|;:\',./<>?"'),
- (u'\u0123\u4567\u89ab\ucdef\uabcd\uef4a', '"\\u0123\\u4567\\u89ab\\ucdef\\uabcd\\uef4a"'),
- (u'controls', '"controls"'),
- (u'\x08\x0c\n\r\t', '"\\b\\f\\n\\r\\t"'),
- (u'{"object with 1 member":["array with 1 element"]}', '"{\\"object with 1 member\\":[\\"array with 1 element\\"]}"'),
- (u' s p a c e d ', '" s p a c e d "'),
- (u'\U0001d120', '"\\ud834\\udd20"'),
- (u'\u03b1\u03a9', '"\\u03b1\\u03a9"'),
- ('\xce\xb1\xce\xa9', '"\\u03b1\\u03a9"'),
- (u'\u03b1\u03a9', '"\\u03b1\\u03a9"'),
- ('\xce\xb1\xce\xa9', '"\\u03b1\\u03a9"'),
- (u'\u03b1\u03a9', '"\\u03b1\\u03a9"'),
- (u'\u03b1\u03a9', '"\\u03b1\\u03a9"'),
- (u"`1~!@#$%^&*()_+-={':[,]}|;.</>?", '"`1~!@#$%^&*()_+-={\':[,]}|;.</>?"'),
- (u'\x08\x0c\n\r\t', '"\\b\\f\\n\\r\\t"'),
- (u'\u0123\u4567\u89ab\ucdef\uabcd\uef4a', '"\\u0123\\u4567\\u89ab\\ucdef\\uabcd\\uef4a"'),
-]
-
-class TestEncodeBaseStringAscii(TestCase):
- def test_py_encode_basestring_ascii(self):
- self._test_encode_basestring_ascii(simplejson.encoder.py_encode_basestring_ascii)
-
- def test_c_encode_basestring_ascii(self):
- if not simplejson.encoder.c_encode_basestring_ascii:
- return
- self._test_encode_basestring_ascii(simplejson.encoder.c_encode_basestring_ascii)
-
- def _test_encode_basestring_ascii(self, encode_basestring_ascii):
- fname = encode_basestring_ascii.__name__
- for input_string, expect in CASES:
- result = encode_basestring_ascii(input_string)
- #self.assertEquals(result, expect,
- # '{0!r} != {1!r} for {2}({3!r})'.format(
- # result, expect, fname, input_string))
- self.assertEquals(result, expect,
- '%r != %r for %s(%r)' % (result, expect, fname, input_string))
-
- def test_sorted_dict(self):
- items = [('one', 1), ('two', 2), ('three', 3), ('four', 4), ('five', 5)]
- s = simplejson.dumps(dict(items), sort_keys=True)
- self.assertEqual(s, '{"five": 5, "four": 4, "one": 1, "three": 3, "two": 2}')
deleted file mode 100644
--- a/mail/test/resources/simplejson-2.1.6/simplejson/tests/test_encode_for_html.py
+++ /dev/null
@@ -1,32 +0,0 @@
-import unittest
-
-import simplejson.decoder
-import simplejson.encoder
-
-
-class TestEncodeForHTML(unittest.TestCase):
-
- def setUp(self):
- self.decoder = simplejson.decoder.JSONDecoder()
- self.encoder = simplejson.encoder.JSONEncoderForHTML()
-
- def test_basic_encode(self):
- self.assertEqual(r'"\u0026"', self.encoder.encode('&'))
- self.assertEqual(r'"\u003c"', self.encoder.encode('<'))
- self.assertEqual(r'"\u003e"', self.encoder.encode('>'))
-
- def test_basic_roundtrip(self):
- for char in '&<>':
- self.assertEqual(
- char, self.decoder.decode(
- self.encoder.encode(char)))
-
- def test_prevent_script_breakout(self):
- bad_string = '</script><script>alert("gotcha")</script>'
- self.assertEqual(
- r'"\u003c/script\u003e\u003cscript\u003e'
- r'alert(\"gotcha\")\u003c/script\u003e"',
- self.encoder.encode(bad_string))
- self.assertEqual(
- bad_string, self.decoder.decode(
- self.encoder.encode(bad_string)))
deleted file mode 100644
--- a/mail/test/resources/simplejson-2.1.6/simplejson/tests/test_errors.py
+++ /dev/null
@@ -1,21 +0,0 @@
-from unittest import TestCase
-
-import simplejson as json
-
-class TestErrors(TestCase):
- def test_string_keys_error(self):
- data = [{'a': 'A', 'b': (2, 4), 'c': 3.0, ('d',): 'D tuple'}]
- self.assertRaises(TypeError, json.dumps, data)
-
- def test_decode_error(self):
- err = None
- try:
- json.loads('{}\na\nb')
- except json.JSONDecodeError, e:
- err = e
- else:
- self.fail('Expected JSONDecodeError')
- self.assertEquals(err.lineno, 2)
- self.assertEquals(err.colno, 1)
- self.assertEquals(err.endlineno, 3)
- self.assertEquals(err.endcolno, 2)
deleted file mode 100644
--- a/mail/test/resources/simplejson-2.1.6/simplejson/tests/test_fail.py
+++ /dev/null
@@ -1,91 +0,0 @@
-from unittest import TestCase
-
-import simplejson as json
-
-# Fri Dec 30 18:57:26 2005
-JSONDOCS = [
- # http://json.org/JSON_checker/test/fail1.json
- '"A JSON payload should be an object or array, not a string."',
- # http://json.org/JSON_checker/test/fail2.json
- '["Unclosed array"',
- # http://json.org/JSON_checker/test/fail3.json
- '{unquoted_key: "keys must be quoted}',
- # http://json.org/JSON_checker/test/fail4.json
- '["extra comma",]',
- # http://json.org/JSON_checker/test/fail5.json
- '["double extra comma",,]',
- # http://json.org/JSON_checker/test/fail6.json
- '[ , "<-- missing value"]',
- # http://json.org/JSON_checker/test/fail7.json
- '["Comma after the close"],',
- # http://json.org/JSON_checker/test/fail8.json
- '["Extra close"]]',
- # http://json.org/JSON_checker/test/fail9.json
- '{"Extra comma": true,}',
- # http://json.org/JSON_checker/test/fail10.json
- '{"Extra value after close": true} "misplaced quoted value"',
- # http://json.org/JSON_checker/test/fail11.json
- '{"Illegal expression": 1 + 2}',
- # http://json.org/JSON_checker/test/fail12.json
- '{"Illegal invocation": alert()}',
- # http://json.org/JSON_checker/test/fail13.json
- '{"Numbers cannot have leading zeroes": 013}',
- # http://json.org/JSON_checker/test/fail14.json
- '{"Numbers cannot be hex": 0x14}',
- # http://json.org/JSON_checker/test/fail15.json
- '["Illegal backslash escape: \\x15"]',
- # http://json.org/JSON_checker/test/fail16.json
- '["Illegal backslash escape: \\\'"]',
- # http://json.org/JSON_checker/test/fail17.json
- '["Illegal backslash escape: \\017"]',
- # http://json.org/JSON_checker/test/fail18.json
- '[[[[[[[[[[[[[[[[[[[["Too deep"]]]]]]]]]]]]]]]]]]]]',
- # http://json.org/JSON_checker/test/fail19.json
- '{"Missing colon" null}',
- # http://json.org/JSON_checker/test/fail20.json
- '{"Double colon":: null}',
- # http://json.org/JSON_checker/test/fail21.json
- '{"Comma instead of colon", null}',
- # http://json.org/JSON_checker/test/fail22.json
- '["Colon instead of comma": false]',
- # http://json.org/JSON_checker/test/fail23.json
- '["Bad value", truth]',
- # http://json.org/JSON_checker/test/fail24.json
- "['single quote']",
- # http://code.google.com/p/simplejson/issues/detail?id=3
- u'["A\u001FZ control characters in string"]',
-]
-
-SKIPS = {
- 1: "why not have a string payload?",
- 18: "spec doesn't specify any nesting limitations",
-}
-
-class TestFail(TestCase):
- def test_failures(self):
- for idx, doc in enumerate(JSONDOCS):
- idx = idx + 1
- if idx in SKIPS:
- json.loads(doc)
- continue
- try:
- json.loads(doc)
- except json.JSONDecodeError:
- pass
- else:
- #self.fail("Expected failure for fail{0}.json: {1!r}".format(idx, doc))
- self.fail("Expected failure for fail%d.json: %r" % (idx, doc))
-
- def test_array_decoder_issue46(self):
- # http://code.google.com/p/simplejson/issues/detail?id=46
- for doc in [u'[,]', '[,]']:
- try:
- json.loads(doc)
- except json.JSONDecodeError, e:
- self.assertEquals(e.pos, 1)
- self.assertEquals(e.lineno, 1)
- self.assertEquals(e.colno, 1)
- except Exception, e:
- self.fail("Unexpected exception raised %r %s" % (e, e))
- else:
- self.fail("Unexpected success parsing '[,]'")
\ No newline at end of file
deleted file mode 100644
--- a/mail/test/resources/simplejson-2.1.6/simplejson/tests/test_float.py
+++ /dev/null
@@ -1,19 +0,0 @@
-import math
-from unittest import TestCase
-
-import simplejson as json
-
-class TestFloat(TestCase):
- def test_floats(self):
- for num in [1617161771.7650001, math.pi, math.pi**100,
- math.pi**-100, 3.1]:
- self.assertEquals(float(json.dumps(num)), num)
- self.assertEquals(json.loads(json.dumps(num)), num)
- self.assertEquals(json.loads(unicode(json.dumps(num))), num)
-
- def test_ints(self):
- for num in [1, 1L, 1<<32, 1<<64]:
- self.assertEquals(json.dumps(num), str(num))
- self.assertEquals(int(json.dumps(num)), num)
- self.assertEquals(json.loads(json.dumps(num)), num)
- self.assertEquals(json.loads(unicode(json.dumps(num))), num)
deleted file mode 100644
--- a/mail/test/resources/simplejson-2.1.6/simplejson/tests/test_indent.py
+++ /dev/null
@@ -1,86 +0,0 @@
-from unittest import TestCase
-
-import simplejson as json
-import textwrap
-from StringIO import StringIO
-
-class TestIndent(TestCase):
- def test_indent(self):
- h = [['blorpie'], ['whoops'], [], 'd-shtaeou', 'd-nthiouh',
- 'i-vhbjkhnth',
- {'nifty': 87}, {'field': 'yes', 'morefield': False} ]
-
- expect = textwrap.dedent("""\
- [
- \t[
- \t\t"blorpie"
- \t],
- \t[
- \t\t"whoops"
- \t],
- \t[],
- \t"d-shtaeou",
- \t"d-nthiouh",
- \t"i-vhbjkhnth",
- \t{
- \t\t"nifty": 87
- \t},
- \t{
- \t\t"field": "yes",
- \t\t"morefield": false
- \t}
- ]""")
-
-
- d1 = json.dumps(h)
- d2 = json.dumps(h, indent='\t', sort_keys=True, separators=(',', ': '))
- d3 = json.dumps(h, indent=' ', sort_keys=True, separators=(',', ': '))
- d4 = json.dumps(h, indent=2, sort_keys=True, separators=(',', ': '))
-
- h1 = json.loads(d1)
- h2 = json.loads(d2)
- h3 = json.loads(d3)
- h4 = json.loads(d4)
-
- self.assertEquals(h1, h)
- self.assertEquals(h2, h)
- self.assertEquals(h3, h)
- self.assertEquals(h4, h)
- self.assertEquals(d3, expect.replace('\t', ' '))
- self.assertEquals(d4, expect.replace('\t', ' '))
- # NOTE: Python 2.4 textwrap.dedent converts tabs to spaces,
- # so the following is expected to fail. Python 2.4 is not a
- # supported platform in simplejson 2.1.0+.
- self.assertEquals(d2, expect)
-
- def test_indent0(self):
- h = {3: 1}
- def check(indent, expected):
- d1 = json.dumps(h, indent=indent)
- self.assertEquals(d1, expected)
-
- sio = StringIO()
- json.dump(h, sio, indent=indent)
- self.assertEquals(sio.getvalue(), expected)
-
- # indent=0 should emit newlines
- check(0, '{\n"3": 1\n}')
- # indent=None is more compact
- check(None, '{"3": 1}')
-
- def test_separators(self):
- lst = [1,2,3,4]
- expect = '[\n1,\n2,\n3,\n4\n]'
- expect_spaces = '[\n1, \n2, \n3, \n4\n]'
- # Ensure that separators still works
- self.assertEquals(
- expect_spaces,
- json.dumps(lst, indent=0, separators=(', ', ': ')))
- # Force the new defaults
- self.assertEquals(
- expect,
- json.dumps(lst, indent=0, separators=(',', ': ')))
- # Added in 2.1.4
- self.assertEquals(
- expect,
- json.dumps(lst, indent=0))
\ No newline at end of file
deleted file mode 100644
--- a/mail/test/resources/simplejson-2.1.6/simplejson/tests/test_pass1.py
+++ /dev/null
@@ -1,76 +0,0 @@
-from unittest import TestCase
-
-import simplejson as json
-
-# from http://json.org/JSON_checker/test/pass1.json
-JSON = r'''
-[
- "JSON Test Pattern pass1",
- {"object with 1 member":["array with 1 element"]},
- {},
- [],
- -42,
- true,
- false,
- null,
- {
- "integer": 1234567890,
- "real": -9876.543210,
- "e": 0.123456789e-12,
- "E": 1.234567890E+34,
- "": 23456789012E666,
- "zero": 0,
- "one": 1,
- "space": " ",
- "quote": "\"",
- "backslash": "\\",
- "controls": "\b\f\n\r\t",
- "slash": "/ & \/",
- "alpha": "abcdefghijklmnopqrstuvwyz",
- "ALPHA": "ABCDEFGHIJKLMNOPQRSTUVWYZ",
- "digit": "0123456789",
- "special": "`1~!@#$%^&*()_+-={':[,]}|;.</>?",
- "hex": "\u0123\u4567\u89AB\uCDEF\uabcd\uef4A",
- "true": true,
- "false": false,
- "null": null,
- "array":[ ],
- "object":{ },
- "address": "50 St. James Street",
- "url": "http://www.JSON.org/",
- "comment": "// /* <!-- --",
- "# -- --> */": " ",
- " s p a c e d " :[1,2 , 3
-
-,
-
-4 , 5 , 6 ,7 ],
- "compact": [1,2,3,4,5,6,7],
- "jsontext": "{\"object with 1 member\":[\"array with 1 element\"]}",
- "quotes": "" \u0022 %22 0x22 034 "",
- "\/\\\"\uCAFE\uBABE\uAB98\uFCDE\ubcda\uef4A\b\f\n\r\t`1~!@#$%^&*()_+-=[]{}|;:',./<>?"
-: "A key can be any string"
- },
- 0.5 ,98.6
-,
-99.44
-,
-
-1066
-
-
-,"rosebud"]
-'''
-
-class TestPass1(TestCase):
- def test_parse(self):
- # test in/out equivalence and parsing
- res = json.loads(JSON)
- out = json.dumps(res)
- self.assertEquals(res, json.loads(out))
- try:
- json.dumps(res, allow_nan=False)
- except ValueError:
- pass
- else:
- self.fail("23456789012E666 should be out of range")
deleted file mode 100644
--- a/mail/test/resources/simplejson-2.1.6/simplejson/tests/test_pass2.py
+++ /dev/null
@@ -1,14 +0,0 @@
-from unittest import TestCase
-import simplejson as json
-
-# from http://json.org/JSON_checker/test/pass2.json
-JSON = r'''
-[[[[[[[[[[[[[[[[[[["Not too deep"]]]]]]]]]]]]]]]]]]]
-'''
-
-class TestPass2(TestCase):
- def test_parse(self):
- # test in/out equivalence and parsing
- res = json.loads(JSON)
- out = json.dumps(res)
- self.assertEquals(res, json.loads(out))
deleted file mode 100644
--- a/mail/test/resources/simplejson-2.1.6/simplejson/tests/test_pass3.py
+++ /dev/null
@@ -1,20 +0,0 @@
-from unittest import TestCase
-
-import simplejson as json
-
-# from http://json.org/JSON_checker/test/pass3.json
-JSON = r'''
-{
- "JSON Test Pattern pass3": {
- "The outermost value": "must be an object or array.",
- "In this test": "It is an object."
- }
-}
-'''
-
-class TestPass3(TestCase):
- def test_parse(self):
- # test in/out equivalence and parsing
- res = json.loads(JSON)
- out = json.dumps(res)
- self.assertEquals(res, json.loads(out))
deleted file mode 100644
--- a/mail/test/resources/simplejson-2.1.6/simplejson/tests/test_recursion.py
+++ /dev/null
@@ -1,67 +0,0 @@
-from unittest import TestCase
-
-import simplejson as json
-
-class JSONTestObject:
- pass
-
-
-class RecursiveJSONEncoder(json.JSONEncoder):
- recurse = False
- def default(self, o):
- if o is JSONTestObject:
- if self.recurse:
- return [JSONTestObject]
- else:
- return 'JSONTestObject'
- return json.JSONEncoder.default(o)
-
-
-class TestRecursion(TestCase):
- def test_listrecursion(self):
- x = []
- x.append(x)
- try:
- json.dumps(x)
- except ValueError:
- pass
- else:
- self.fail("didn't raise ValueError on list recursion")
- x = []
- y = [x]
- x.append(y)
- try:
- json.dumps(x)
- except ValueError:
- pass
- else:
- self.fail("didn't raise ValueError on alternating list recursion")
- y = []
- x = [y, y]
- # ensure that the marker is cleared
- json.dumps(x)
-
- def test_dictrecursion(self):
- x = {}
- x["test"] = x
- try:
- json.dumps(x)
- except ValueError:
- pass
- else:
- self.fail("didn't raise ValueError on dict recursion")
- x = {}
- y = {"a": x, "b": x}
- # ensure that the marker is cleared
- json.dumps(y)
-
- def test_defaultrecursion(self):
- enc = RecursiveJSONEncoder()
- self.assertEquals(enc.encode(JSONTestObject), '"JSONTestObject"')
- enc.recurse = True
- try:
- enc.encode(JSONTestObject)
- except ValueError:
- pass
- else:
- self.fail("didn't raise ValueError on default recursion")
deleted file mode 100644
--- a/mail/test/resources/simplejson-2.1.6/simplejson/tests/test_scanstring.py
+++ /dev/null
@@ -1,117 +0,0 @@
-import sys
-from unittest import TestCase
-
-import simplejson as json
-import simplejson.decoder
-
-class TestScanString(TestCase):
- def test_py_scanstring(self):
- self._test_scanstring(simplejson.decoder.py_scanstring)
-
- def test_c_scanstring(self):
- if not simplejson.decoder.c_scanstring:
- return
- self._test_scanstring(simplejson.decoder.c_scanstring)
-
- def _test_scanstring(self, scanstring):
- self.assertEquals(
- scanstring('"z\\ud834\\udd20x"', 1, None, True),
- (u'z\U0001d120x', 16))
-
- if sys.maxunicode == 65535:
- self.assertEquals(
- scanstring(u'"z\U0001d120x"', 1, None, True),
- (u'z\U0001d120x', 6))
- else:
- self.assertEquals(
- scanstring(u'"z\U0001d120x"', 1, None, True),
- (u'z\U0001d120x', 5))
-
- self.assertEquals(
- scanstring('"\\u007b"', 1, None, True),
- (u'{', 8))
-
- self.assertEquals(
- scanstring('"A JSON payload should be an object or array, not a string."', 1, None, True),
- (u'A JSON payload should be an object or array, not a string.', 60))
-
- self.assertEquals(
- scanstring('["Unclosed array"', 2, None, True),
- (u'Unclosed array', 17))
-
- self.assertEquals(
- scanstring('["extra comma",]', 2, None, True),
- (u'extra comma', 14))
-
- self.assertEquals(
- scanstring('["double extra comma",,]', 2, None, True),
- (u'double extra comma', 21))
-
- self.assertEquals(
- scanstring('["Comma after the close"],', 2, None, True),
- (u'Comma after the close', 24))
-
- self.assertEquals(
- scanstring('["Extra close"]]', 2, None, True),
- (u'Extra close', 14))
-
- self.assertEquals(
- scanstring('{"Extra comma": true,}', 2, None, True),
- (u'Extra comma', 14))
-
- self.assertEquals(
- scanstring('{"Extra value after close": true} "misplaced quoted value"', 2, None, True),
- (u'Extra value after close', 26))
-
- self.assertEquals(
- scanstring('{"Illegal expression": 1 + 2}', 2, None, True),
- (u'Illegal expression', 21))
-
- self.assertEquals(
- scanstring('{"Illegal invocation": alert()}', 2, None, True),
- (u'Illegal invocation', 21))
-
- self.assertEquals(
- scanstring('{"Numbers cannot have leading zeroes": 013}', 2, None, True),
- (u'Numbers cannot have leading zeroes', 37))
-
- self.assertEquals(
- scanstring('{"Numbers cannot be hex": 0x14}', 2, None, True),
- (u'Numbers cannot be hex', 24))
-
- self.assertEquals(
- scanstring('[[[[[[[[[[[[[[[[[[[["Too deep"]]]]]]]]]]]]]]]]]]]]', 21, None, True),
- (u'Too deep', 30))
-
- self.assertEquals(
- scanstring('{"Missing colon" null}', 2, None, True),
- (u'Missing colon', 16))
-
- self.assertEquals(
- scanstring('{"Double colon":: null}', 2, None, True),
- (u'Double colon', 15))
-
- self.assertEquals(
- scanstring('{"Comma instead of colon", null}', 2, None, True),
- (u'Comma instead of colon', 25))
-
- self.assertEquals(
- scanstring('["Colon instead of comma": false]', 2, None, True),
- (u'Colon instead of comma', 25))
-
- self.assertEquals(
- scanstring('["Bad value", truth]', 2, None, True),
- (u'Bad value', 12))
-
- def test_issue3623(self):
- self.assertRaises(ValueError, json.decoder.scanstring, "xxx", 1,
- "xxx")
- self.assertRaises(UnicodeDecodeError,
- json.encoder.encode_basestring_ascii, "xx\xff")
-
- def test_overflow(self):
- # Python 2.5 does not have maxsize
- maxsize = getattr(sys, 'maxsize', sys.maxint)
- self.assertRaises(OverflowError, json.decoder.scanstring, "xxx",
- maxsize + 1)
-
deleted file mode 100644
--- a/mail/test/resources/simplejson-2.1.6/simplejson/tests/test_separators.py
+++ /dev/null
@@ -1,42 +0,0 @@
-import textwrap
-from unittest import TestCase
-
-import simplejson as json
-
-
-class TestSeparators(TestCase):
- def test_separators(self):
- h = [['blorpie'], ['whoops'], [], 'd-shtaeou', 'd-nthiouh', 'i-vhbjkhnth',
- {'nifty': 87}, {'field': 'yes', 'morefield': False} ]
-
- expect = textwrap.dedent("""\
- [
- [
- "blorpie"
- ] ,
- [
- "whoops"
- ] ,
- [] ,
- "d-shtaeou" ,
- "d-nthiouh" ,
- "i-vhbjkhnth" ,
- {
- "nifty" : 87
- } ,
- {
- "field" : "yes" ,
- "morefield" : false
- }
- ]""")
-
-
- d1 = json.dumps(h)
- d2 = json.dumps(h, indent=' ', sort_keys=True, separators=(' ,', ' : '))
-
- h1 = json.loads(d1)
- h2 = json.loads(d2)
-
- self.assertEquals(h1, h)
- self.assertEquals(h2, h)
- self.assertEquals(d2, expect)
deleted file mode 100644
--- a/mail/test/resources/simplejson-2.1.6/simplejson/tests/test_speedups.py
+++ /dev/null
@@ -1,20 +0,0 @@
-from unittest import TestCase
-
-from simplejson import encoder, scanner
-
-def has_speedups():
- return encoder.c_make_encoder is not None
-
-class TestDecode(TestCase):
- def test_make_scanner(self):
- if not has_speedups():
- return
- self.assertRaises(AttributeError, scanner.c_make_scanner, 1)
-
- def test_make_encoder(self):
- if not has_speedups():
- return
- self.assertRaises(TypeError, encoder.c_make_encoder,
- None,
- "\xCD\x7D\x3D\x4E\x12\x4C\xF9\x79\xD7\x52\xBA\x82\xF2\x27\x4A\x7D\xA0\xCA\x75",
- None)
deleted file mode 100644
--- a/mail/test/resources/simplejson-2.1.6/simplejson/tests/test_unicode.py
+++ /dev/null
@@ -1,99 +0,0 @@
-from unittest import TestCase
-
-import simplejson as json
-
-class TestUnicode(TestCase):
- def test_encoding1(self):
- encoder = json.JSONEncoder(encoding='utf-8')
- u = u'\N{GREEK SMALL LETTER ALPHA}\N{GREEK CAPITAL LETTER OMEGA}'
- s = u.encode('utf-8')
- ju = encoder.encode(u)
- js = encoder.encode(s)
- self.assertEquals(ju, js)
-
- def test_encoding2(self):
- u = u'\N{GREEK SMALL LETTER ALPHA}\N{GREEK CAPITAL LETTER OMEGA}'
- s = u.encode('utf-8')
- ju = json.dumps(u, encoding='utf-8')
- js = json.dumps(s, encoding='utf-8')
- self.assertEquals(ju, js)
-
- def test_encoding3(self):
- u = u'\N{GREEK SMALL LETTER ALPHA}\N{GREEK CAPITAL LETTER OMEGA}'
- j = json.dumps(u)
- self.assertEquals(j, '"\\u03b1\\u03a9"')
-
- def test_encoding4(self):
- u = u'\N{GREEK SMALL LETTER ALPHA}\N{GREEK CAPITAL LETTER OMEGA}'
- j = json.dumps([u])
- self.assertEquals(j, '["\\u03b1\\u03a9"]')
-
- def test_encoding5(self):
- u = u'\N{GREEK SMALL LETTER ALPHA}\N{GREEK CAPITAL LETTER OMEGA}'
- j = json.dumps(u, ensure_ascii=False)
- self.assertEquals(j, u'"' + u + u'"')
-
- def test_encoding6(self):
- u = u'\N{GREEK SMALL LETTER ALPHA}\N{GREEK CAPITAL LETTER OMEGA}'
- j = json.dumps([u], ensure_ascii=False)
- self.assertEquals(j, u'["' + u + u'"]')
-
- def test_big_unicode_encode(self):
- u = u'\U0001d120'
- self.assertEquals(json.dumps(u), '"\\ud834\\udd20"')
- self.assertEquals(json.dumps(u, ensure_ascii=False), u'"\U0001d120"')
-
- def test_big_unicode_decode(self):
- u = u'z\U0001d120x'
- self.assertEquals(json.loads('"' + u + '"'), u)
- self.assertEquals(json.loads('"z\\ud834\\udd20x"'), u)
-
- def test_unicode_decode(self):
- for i in range(0, 0xd7ff):
- u = unichr(i)
- #s = '"\\u{0:04x}"'.format(i)
- s = '"\\u%04x"' % (i,)
- self.assertEquals(json.loads(s), u)
-
- def test_object_pairs_hook_with_unicode(self):
- s = u'{"xkd":1, "kcw":2, "art":3, "hxm":4, "qrt":5, "pad":6, "hoy":7}'
- p = [(u"xkd", 1), (u"kcw", 2), (u"art", 3), (u"hxm", 4),
- (u"qrt", 5), (u"pad", 6), (u"hoy", 7)]
- self.assertEqual(json.loads(s), eval(s))
- self.assertEqual(json.loads(s, object_pairs_hook=lambda x: x), p)
- od = json.loads(s, object_pairs_hook=json.OrderedDict)
- self.assertEqual(od, json.OrderedDict(p))
- self.assertEqual(type(od), json.OrderedDict)
- # the object_pairs_hook takes priority over the object_hook
- self.assertEqual(json.loads(s,
- object_pairs_hook=json.OrderedDict,
- object_hook=lambda x: None),
- json.OrderedDict(p))
-
-
- def test_default_encoding(self):
- self.assertEquals(json.loads(u'{"a": "\xe9"}'.encode('utf-8')),
- {'a': u'\xe9'})
-
- def test_unicode_preservation(self):
- self.assertEquals(type(json.loads(u'""')), unicode)
- self.assertEquals(type(json.loads(u'"a"')), unicode)
- self.assertEquals(type(json.loads(u'["a"]')[0]), unicode)
-
- def test_ensure_ascii_false_returns_unicode(self):
- # http://code.google.com/p/simplejson/issues/detail?id=48
- self.assertEquals(type(json.dumps([], ensure_ascii=False)), unicode)
- self.assertEquals(type(json.dumps(0, ensure_ascii=False)), unicode)
- self.assertEquals(type(json.dumps({}, ensure_ascii=False)), unicode)
- self.assertEquals(type(json.dumps("", ensure_ascii=False)), unicode)
-
- def test_ensure_ascii_false_bytestring_encoding(self):
- # http://code.google.com/p/simplejson/issues/detail?id=48
- doc1 = {u'quux': 'Arr\xc3\xaat sur images'}
- doc2 = {u'quux': u'Arr\xeat sur images'}
- doc_ascii = '{"quux": "Arr\\u00eat sur images"}'
- doc_unicode = u'{"quux": "Arr\xeat sur images"}'
- self.assertEquals(json.dumps(doc1), doc_ascii)
- self.assertEquals(json.dumps(doc2), doc_ascii)
- self.assertEquals(json.dumps(doc1, ensure_ascii=False), doc_unicode)
- self.assertEquals(json.dumps(doc2, ensure_ascii=False), doc_unicode)
deleted file mode 100644
--- a/mail/test/resources/simplejson-2.1.6/simplejson/tool.py
+++ /dev/null
@@ -1,39 +0,0 @@
-r"""Command-line tool to validate and pretty-print JSON
-
-Usage::
-
- $ echo '{"json":"obj"}' | python -m simplejson.tool
- {
- "json": "obj"
- }
- $ echo '{ 1.2:3.4}' | python -m simplejson.tool
- Expecting property name: line 1 column 2 (char 2)
-
-"""
-import sys
-import simplejson as json
-
-def main():
- if len(sys.argv) == 1:
- infile = sys.stdin
- outfile = sys.stdout
- elif len(sys.argv) == 2:
- infile = open(sys.argv[1], 'rb')
- outfile = sys.stdout
- elif len(sys.argv) == 3:
- infile = open(sys.argv[1], 'rb')
- outfile = open(sys.argv[2], 'wb')
- else:
- raise SystemExit(sys.argv[0] + " [infile [outfile]]")
- try:
- obj = json.load(infile,
- object_pairs_hook=json.OrderedDict,
- use_decimal=True)
- except ValueError, e:
- raise SystemExit(e)
- json.dump(obj, outfile, sort_keys=True, indent=' ', use_decimal=True)
- outfile.write('\n')
-
-
-if __name__ == '__main__':
- main()
deleted file mode 100644
--- a/mail/test/resources/virtualenv/AUTHORS.txt
+++ /dev/null
@@ -1,29 +0,0 @@
-Author
-------
-
-Ian Bicking
-
-Maintainers
------------
-
-Brian Rosner
-Carl Meyer
-Jannis Leidel
-
-Contributors
-------------
-
-Antonio Cuni
-Armin Ronacher
-Christopher Nilsson
-Curt Micol
-Douglas Creager
-Jeff Hammel
-Jorge Vargas
-Josh Bronson
-Kumar McMillan
-Lars Francke
-Philip Jenvey
-Ronny Pfannschmidt
-Tarek Ziadé
-Vinay Sajip
deleted file mode 100644
--- a/mail/test/resources/virtualenv/LICENSE.txt
+++ /dev/null
@@ -1,22 +0,0 @@
-Copyright (c) 2007 Ian Bicking and Contributors
-Copyright (c) 2009 Ian Bicking, The Open Planning Project
-Copyright (c) 2011 The virtualenv developers
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
deleted file mode 100644
--- a/mail/test/resources/virtualenv/MANIFEST.in
+++ /dev/null
@@ -1,9 +0,0 @@
-recursive-include docs *.txt
-recursive-include scripts *
-recursive-include virtualenv_support *.egg *.tar.gz
-recursive-exclude virtualenv_support *.py
-recursive-exclude docs/_templates *.*
-include virtualenv_support/__init__.py
-include *.py
-include AUTHORS.txt
-include LICENSE.txt
\ No newline at end of file
deleted file mode 100644
--- a/mail/test/resources/virtualenv/PKG-INFO
+++ /dev/null
@@ -1,798 +0,0 @@
-Metadata-Version: 1.0
-Name: virtualenv
-Version: 1.6.1
-Summary: Virtual Python Environment builder
-Home-page: http://www.virtualenv.org
-Author: Jannis Leidel, Carl Meyer and Brian Rosner
-Author-email: python-virtualenv@groups.google.com
-License: MIT
-Description:
-
- Status and License
- ------------------
-
- ``virtualenv`` is a successor to `workingenv
- <http://cheeseshop.python.org/pypi/workingenv.py>`_, and an extension
- of `virtual-python
- <http://peak.telecommunity.com/DevCenter/EasyInstall#creating-a-virtual-python>`_.
-
- It was written by Ian Bicking, sponsored by the `Open Planning
- Project <http://openplans.org>`_ and is now maintained by a
- `group of developers <https://github.com/pypa/virtualenv/raw/master/AUTHORS.txt>`_.
- It is licensed under an
- `MIT-style permissive license <https://github.com/pypa/virtualenv/raw/master/LICENSE.txt>`_.
-
- You can install it with ``easy_install virtualenv``, or from the `git
- repository <https://github.com/pypa/virtualenv>`_ or from a `tarball
- <https://github.com/pypa/virtualenv/tarball/master#egg=virtualenv-dev>`_
- ``easy_install virtualenv==dev``.
-
- What It Does
- ------------
-
- ``virtualenv`` is a tool to create isolated Python environments.
-
- The basic problem being addressed is one of dependencies and versions,
- and indirectly permissions. Imagine you have an application that
- needs version 1 of LibFoo, but another application requires version
- 2. How can you use both these applications? If you install
- everything into ``/usr/lib/python2.7/site-packages`` (or whatever your
- platform's standard location is), it's easy to end up in a situation
- where you unintentionally upgrade an application that shouldn't be
- upgraded.
-
- Or more generally, what if you want to install an application *and
- leave it be*? If an application works, any change in its libraries or
- the versions of those libraries can break the application.
-
- Also, what if you can't install packages into the global
- ``site-packages`` directory? For instance, on a shared host.
-
- In all these cases, ``virtualenv`` can help you. It creates an
- environment that has its own installation directories, that doesn't
- share libraries with other virtualenv environments (and optionally
- doesn't access the globally installed libraries either).
-
- The basic usage is::
-
- $ python virtualenv.py ENV
-
- If you install it you can also just do ``virtualenv ENV``.
-
- This creates ``ENV/lib/pythonX.X/site-packages``, where any libraries you
- install will go. It also creates ``ENV/bin/python``, which is a Python
- interpreter that uses this environment. Anytime you use that interpreter
- (including when a script has ``#!/path/to/ENV/bin/python`` in it) the libraries
- in that environment will be used.
-
- It also installs either `Setuptools
- <http://peak.telecommunity.com/DevCenter/setuptools>`_ or `distribute
- <http://pypi.python.org/pypi/distribute>`_ into the environment. To use
- Distribute instead of setuptools, just call virtualenv like this::
-
- $ python virtualenv.py --distribute ENV
-
- You can also set the environment variable VIRTUALENV_USE_DISTRIBUTE.
-
- A new virtualenv also includes the `pip <http://pypy.python.org/pypi/pip>`_
- installer, so you can use `ENV/bin/pip`` to install additional packages into
- the environment.
-
- Windows Notes
- ~~~~~~~~~~~~~
-
- Some paths within the virtualenv are slightly different on Windows: scripts and
- executables on Windows go in ``ENV\Scripts\`` instead of ``ENV/bin/`` and
- libraries go in ``ENV\Lib\`` rather than ``ENV/lib/``.
-
- To create a virtualenv under a path with spaces in it on Windows, you'll need
- the `win32api <http://sourceforge.net/projects/pywin32/>`_ library installed.
-
- PyPy Support
- ~~~~~~~~~~~~
-
- Beginning with virtualenv version 1.5 there is experimental `PyPy
- <http://pypy.org>`_ support. Currently only PyPy trunk is supported.
-
- Creating Your Own Bootstrap Scripts
- -----------------------------------
-
- While this creates an environment, it doesn't put anything into the
- environment. Developers may find it useful to distribute a script
- that sets up a particular environment, for example a script that
- installs a particular web application.
-
- To create a script like this, call
- ``virtualenv.create_bootstrap_script(extra_text)``, and write the
- result to your new bootstrapping script. Here's the documentation
- from the docstring:
-
- Creates a bootstrap script, which is like this script but with
- extend_parser, adjust_options, and after_install hooks.
-
- This returns a string that (written to disk of course) can be used
- as a bootstrap script with your own customizations. The script
- will be the standard virtualenv.py script, with your extra text
- added (your extra text should be Python code).
-
- If you include these functions, they will be called:
-
- ``extend_parser(optparse_parser)``:
- You can add or remove options from the parser here.
-
- ``adjust_options(options, args)``:
- You can change options here, or change the args (if you accept
- different kinds of arguments, be sure you modify ``args`` so it is
- only ``[DEST_DIR]``).
-
- ``after_install(options, home_dir)``:
-
- After everything is installed, this function is called. This
- is probably the function you are most likely to use. An
- example would be::
-
- def after_install(options, home_dir):
- if sys.platform == 'win32':
- bin = 'Scripts'
- else:
- bin = 'bin'
- subprocess.call([join(home_dir, bin, 'easy_install'),
- 'MyPackage'])
- subprocess.call([join(home_dir, bin, 'my-package-script'),
- 'setup', home_dir])
-
- This example immediately installs a package, and runs a setup
- script from that package.
-
- Bootstrap Example
- ~~~~~~~~~~~~~~~~~
-
- Here's a more concrete example of how you could use this::
-
- import virtualenv, textwrap
- output = virtualenv.create_bootstrap_script(textwrap.dedent("""
- import os, subprocess
- def after_install(options, home_dir):
- etc = join(home_dir, 'etc')
- if not os.path.exists(etc):
- os.makedirs(etc)
- subprocess.call([join(home_dir, 'bin', 'easy_install'),
- 'BlogApplication'])
- subprocess.call([join(home_dir, 'bin', 'paster'),
- 'make-config', 'BlogApplication',
- join(etc, 'blog.ini')])
- subprocess.call([join(home_dir, 'bin', 'paster'),
- 'setup-app', join(etc, 'blog.ini')])
- """))
- f = open('blog-bootstrap.py', 'w').write(output)
-
- Another example is available `here
- <https://svn.openplans.org/svn/fassembler/trunk/fassembler/create-venv-script.py>`_.
-
- activate script
- ~~~~~~~~~~~~~~~
-
- In a newly created virtualenv there will be a ``bin/activate`` shell
- script, or a ``Scripts/activate.bat`` batch file on Windows.
-
- On Posix systems you can do::
-
- $ source bin/activate
-
- This will change your ``$PATH`` to point to the virtualenv's ``bin/``
- directory. (You have to use ``source`` because it changes your shell
- environment in-place.) This is all it does; it's purely a convenience. If
- you directly run a script or the python interpreter from the virtualenv's
- ``bin/`` directory (e.g. ``path/to/env/bin/pip`` or
- ``/path/to/env/bin/python script.py``) there's no need for activation.
-
- After activating an environment you can use the function ``deactivate`` to
- undo the changes to your ``$PATH``.
-
- The ``activate`` script will also modify your shell prompt to indicate
- which environment is currently active. You can disable this behavior,
- which can be useful if you have your own custom prompt that already
- displays the active environment name. To do so, set the
- ``VIRTUAL_ENV_DISABLE_PROMPT`` environment variable to any non-empty
- value before running the ``activate`` script.
-
- On Windows you just do::
-
- > \path\to\env\bin\activate.bat
-
- And use ``deactivate.bat`` to undo the changes.
-
- The ``--no-site-packages`` Option
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
- If you build with ``virtualenv --no-site-packages ENV`` it will *not*
- inherit any packages from ``/usr/lib/python2.5/site-packages`` (or
- wherever your global site-packages directory is). This can be used if
- you don't have control over site-packages and don't want to depend on
- the packages there, or you just want more isolation from the global
- system.
-
- Using Virtualenv without ``bin/python``
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
- Sometimes you can't or don't want to use the Python interpreter
- created by the virtualenv. For instance, in a `mod_python
- <http://www.modpython.org/>`_ or `mod_wsgi <http://www.modwsgi.org/>`_
- environment, there is only one interpreter.
-
- Luckily, it's easy. You must use the custom Python interpreter to
- *install* libraries. But to *use* libraries, you just have to be sure
- the path is correct. A script is available to correct the path. You
- can setup the environment like::
-
- activate_this = '/path/to/env/bin/activate_this.py'
- execfile(activate_this, dict(__file__=activate_this))
-
- This will change ``sys.path`` and even change ``sys.prefix``, but also allow
- you to use an existing interpreter. Items in your environment will show up
- first on ``sys.path``, before global items. However, global items will
- always be accessible -- this technique does not support the
- ``--no-site-packages`` flag. Also, this cannot undo the activation of other
- environments, or modules that have been imported. You shouldn't try to, for
- instance, activate an environment before a web request; you should activate
- *one* environment as early as possible, and not do it again in that process.
-
- Making Environments Relocatable
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
- Note: this option is somewhat experimental, and there are probably
- caveats that have not yet been identified. Also this does not
- currently work on Windows.
-
- Normally environments are tied to a specific path. That means that
- you cannot move an environment around or copy it to another computer.
- You can fix up an environment to make it relocatable with the
- command::
-
- $ virtualenv --relocatable ENV
-
- This will make some of the files created by setuptools or distribute
- use relative paths, and will change all the scripts to use ``activate_this.py``
- instead of using the location of the Python interpreter to select the
- environment.
-
- **Note:** you must run this after you've installed *any* packages into
- the environment. If you make an environment relocatable, then
- install a new package, you must run ``virtualenv --relocatable``
- again.
-
- Also, this **does not make your packages cross-platform**. You can
- move the directory around, but it can only be used on other similar
- computers. Some known environmental differences that can cause
- incompatibilities: a different version of Python, when one platform
- uses UCS2 for its internal unicode representation and another uses
- UCS4 (a compile-time option), obvious platform changes like Windows
- vs. Linux, or Intel vs. ARM, and if you have libraries that bind to C
- libraries on the system, if those C libraries are located somewhere
- different (either different versions, or a different filesystem
- layout).
-
- Currently the ``--no-site-packages`` option will not be honored if you
- use this on an environment.
-
- The ``--extra-search-dir`` Option
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
- When it creates a new environment, virtualenv installs either
- setuptools or distribute, and pip. In normal operation, the latest
- releases of these packages are fetched from the `Python Package Index
- <http://pypi.python.org>`_ (PyPI). In some circumstances, this
- behavior may not be wanted, for example if you are using virtualenv
- during a deployment and do not want to depend on Internet access and
- PyPI availability.
-
- As an alternative, you can provide your own versions of setuptools,
- distribute and/or pip on the filesystem, and tell virtualenv to use
- those distributions instead of downloading them from the Internet. To
- use this feature, pass one or more ``--extra-search-dir`` options to
- virtualenv like this::
-
- $ virtualenv --extra-search-dir=/path/to/distributions ENV
-
- The ``/path/to/distributions`` path should point to a directory that
- contains setuptools, distribute and/or pip distributions. Setuptools
- distributions must be ``.egg`` files; distribute and pip distributions
- should be `.tar.gz` source distributions.
-
- Virtualenv will still download these packages if no satisfactory local
- distributions are found.
-
- If you are really concerned about virtualenv fetching these packages
- from the Internet and want to ensure that it never will, you can also
- provide an option ``--never-download`` like so::
-
- $ virtualenv --extra-search-dir=/path/to/distributions --never-download ENV
-
- If this option is provided, virtualenv will never try to download
- setuptools/distribute or pip. Instead, it will exit with status code 1
- if it fails to find local distributions for any of these required
- packages.
-
- Compare & Contrast with Alternatives
- ------------------------------------
-
- There are several alternatives that create isolated environments:
-
- * ``workingenv`` (which I do not suggest you use anymore) is the
- predecessor to this library. It used the main Python interpreter,
- but relied on setting ``$PYTHONPATH`` to activate the environment.
- This causes problems when running Python scripts that aren't part of
- the environment (e.g., a globally installed ``hg`` or ``bzr``). It
- also conflicted a lot with Setuptools.
-
- * `virtual-python
- <http://peak.telecommunity.com/DevCenter/EasyInstall#creating-a-virtual-python>`_
- is also a predecessor to this library. It uses only symlinks, so it
- couldn't work on Windows. It also symlinks over the *entire*
- standard library and global ``site-packages``. As a result, it
- won't see new additions to the global ``site-packages``.
-
- This script only symlinks a small portion of the standard library
- into the environment, and so on Windows it is feasible to simply
- copy these files over. Also, it creates a new/empty
- ``site-packages`` and also adds the global ``site-packages`` to the
- path, so updates are tracked separately. This script also installs
- Setuptools automatically, saving a step and avoiding the need for
- network access.
-
- * `zc.buildout <http://pypi.python.org/pypi/zc.buildout>`_ doesn't
- create an isolated Python environment in the same style, but
- achieves similar results through a declarative config file that sets
- up scripts with very particular packages. As a declarative system,
- it is somewhat easier to repeat and manage, but more difficult to
- experiment with. ``zc.buildout`` includes the ability to setup
- non-Python systems (e.g., a database server or an Apache instance).
-
- I *strongly* recommend anyone doing application development or
- deployment use one of these tools.
-
- Contributing
- ------------
-
- Refer to the `contributing to pip`_ documentation - it applies equally to
- virtualenv.
-
- Virtualenv's release schedule is tied to pip's -- each time there's a new pip
- release, there will be a new virtualenv release that bundles the new version of
- pip.
-
- .. _contributing to pip: http://www.pip-installer.org/en/latest/how-to-contribute.html
-
- Running the tests
- ~~~~~~~~~~~~~~~~~
-
- Virtualenv's test suite is small and not yet at all comprehensive, but we aim
- to grow it.
-
- The easy way to run tests (handles test dependencies automatically)::
-
- $ python setup.py test
-
- If you want to run only a selection of the tests, you'll need to run them
- directly with nose instead. Create a virtualenv, and install required
- packages::
-
- $ pip install nose mock
-
- Run nosetests::
-
- $ nosetests
-
- Or select just a single test file to run::
-
- $ nosetests tests.test_virtualenv
-
-
- Other Documentation and Links
- -----------------------------
-
- * James Gardner has written a tutorial on using `virtualenv with
- Pylons
- <http://wiki.pylonshq.com/display/pylonscookbook/Using+a+Virtualenv+Sandbox>`_.
-
- * `Blog announcement
- <http://blog.ianbicking.org/2007/10/10/workingenv-is-dead-long-live-virtualenv/>`_.
-
- * Doug Hellmann wrote a description of his `command-line work flow
- using virtualenv (virtualenvwrapper)
- <http://www.doughellmann.com/articles/CompletelyDifferent-2008-05-virtualenvwrapper/index.html>`_
- including some handy scripts to make working with multiple
- environments easier. He also wrote `an example of using virtualenv
- to try IPython
- <http://www.doughellmann.com/articles/CompletelyDifferent-2008-02-ipython-and-virtualenv/index.html>`_.
-
- * Chris Perkins created a `showmedo video including virtualenv
- <http://showmedo.com/videos/video?name=2910000&fromSeriesID=291>`_.
-
- * `Using virtualenv with mod_wsgi
- <http://code.google.com/p/modwsgi/wiki/VirtualEnvironments>`_.
-
- * `virtualenv commands
- <http://thisismedium.com/tech/extending-virtualenv/>`_ for some more
- workflow-related tools around virtualenv.
-
- Changes & News
- --------------
-
- Next release (1.7) schedule
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
- Beta release mid-July 2011, final release early August.
-
-
- 1.6.1 (2011-04-30)
- ~~~~~~~~~~~~~~~~~~
-
- * Start to use git-flow.
-
- * Added support for PyPy 1.5
-
- * Fixed #121 -- added sanity-checking of the -p argument. Thanks Paul Nasrat.
-
- * Added progress meter for pip installation as well as setuptools. Thanks Ethan
- Jucovy.
-
- * Added --never-download and --search-dir options. Thanks Ethan Jucovy.
-
- 1.6
- ~~~
-
- * Added Python 3 support! Huge thanks to Vinay Sajip and Vitaly Babiy.
-
- * Fixed creation of virtualenvs on Mac OS X when standard library modules
- (readline) are installed outside the standard library.
-
- * Updated bundled pip to 1.0.
-
- 1.5.2
- ~~~~~
-
- * Moved main repository to Github: https://github.com/pypa/virtualenv
-
- * Transferred primary maintenance from Ian to Jannis Leidel, Carl Meyer and Brian Rosner
-
- * Fixed a few more pypy related bugs.
-
- * Updated bundled pip to 0.8.2.
-
- * Handed project over to new team of maintainers.
-
- * Moved virtualenv to Github at https://github.com/pypa/virtualenv
-
- 1.5.1
- ~~~~~
-
- * Added ``_weakrefset`` requirement for Python 2.7.1.
-
- * Fixed Windows regression in 1.5
-
- 1.5
- ~~~
-
- * Include pip 0.8.1.
-
- * Add support for PyPy.
-
- * Uses a proper temporary dir when installing environment requirements.
-
- * Add ``--prompt`` option to be able to override the default prompt prefix.
-
- * Fix an issue with ``--relocatable`` on Windows.
-
- * Fix issue with installing the wrong version of distribute.
-
- * Add fish and csh activate scripts.
-
- 1.4.9
- ~~~~~
-
- * Include pip 0.7.2
-
- 1.4.8
- ~~~~~
-
- * Fix for Mac OS X Framework builds that use
- ``--universal-archs=intel``
-
- * Fix ``activate_this.py`` on Windows.
-
- * Allow ``$PYTHONHOME`` to be set, so long as you use ``source
- bin/activate`` it will get unset; if you leave it set and do not
- activate the environment it will still break the environment.
-
- * Include pip 0.7.1
-
- 1.4.7
- ~~~~~
-
- * Include pip 0.7
-
- 1.4.6
- ~~~~~
-
- * Allow ``activate.sh`` to skip updating the prompt (by setting
- ``$VIRTUAL_ENV_DISABLE_PROMPT``).
-
- 1.4.5
- ~~~~~
-
- * Include pip 0.6.3
-
- * Fix ``activate.bat`` and ``deactivate.bat`` under Windows when
- ``PATH`` contained a parenthesis
-
- 1.4.4
- ~~~~~
-
- * Include pip 0.6.2 and Distribute 0.6.10
-
- * Create the ``virtualenv`` script even when Setuptools isn't
- installed
-
- * Fix problem with ``virtualenv --relocate`` when ``bin/`` has
- subdirectories (e.g., ``bin/.svn/``); from Alan Franzoni.
-
- * If you set ``$VIRTUALENV_USE_DISTRIBUTE`` then virtualenv will use
- Distribute by default (so you don't have to remember to use
- ``--distribute``).
-
- 1.4.3
- ~~~~~
-
- * Include pip 0.6.1
-
- 1.4.2
- ~~~~~
-
- * Fix pip installation on Windows
-
- * Fix use of stand-alone ``virtualenv.py`` (and boot scripts)
-
- * Exclude ~/.local (user site-packages) from environments when using
- ``--no-site-packages``
-
- 1.4.1
- ~~~~~
-
- * Include pip 0.6
-
- 1.4
- ~~~
-
- * Updated setuptools to 0.6c11
-
- * Added the --distribute option
-
- * Fixed packaging problem of support-files
-
- 1.3.4
- ~~~~~
-
- * Virtualenv now copies the actual embedded Python binary on
- Mac OS X to fix a hang on Snow Leopard (10.6).
-
- * Fail more gracefully on Windows when ``win32api`` is not installed.
-
- * Fix site-packages taking precedent over Jython's ``__classpath__``
- and also specially handle the new ``__pyclasspath__`` entry in
- ``sys.path``.
-
- * Now copies Jython's ``registry`` file to the virtualenv if it exists.
-
- * Better find libraries when compiling extensions on Windows.
-
- * Create ``Scripts\pythonw.exe`` on Windows.
-
- * Added support for the Debian/Ubuntu
- ``/usr/lib/pythonX.Y/dist-packages`` directory.
-
- * Set ``distutils.sysconfig.get_config_vars()['LIBDIR']`` (based on
- ``sys.real_prefix``) which is reported to help building on Windows.
-
- * Make ``deactivate`` work on ksh
-
- * Fixes for ``--python``: make it work with ``--relocatable`` and the
- symlink created to the exact Python version.
-
- 1.3.3
- ~~~~~
-
- * Use Windows newlines in ``activate.bat``, which has been reported to help
- when using non-ASCII directory names.
-
- * Fixed compatibility with Jython 2.5b1.
-
- * Added a function ``virtualenv.install_python`` for more fine-grained
- access to what ``virtualenv.create_environment`` does.
-
- * Fix `a problem <https://bugs.launchpad.net/virtualenv/+bug/241581>`_
- with Windows and paths that contain spaces.
-
- * If ``/path/to/env/.pydistutils.cfg`` exists (or
- ``/path/to/env/pydistutils.cfg`` on Windows systems) then ignore
- ``~/.pydistutils.cfg`` and use that other file instead.
-
- * Fix ` a problem
- <https://bugs.launchpad.net/virtualenv/+bug/340050>`_ picking up
- some ``.so`` libraries in ``/usr/local``.
-
- 1.3.2
- ~~~~~
-
- * Remove the ``[install] prefix = ...`` setting from the virtualenv
- ``distutils.cfg`` -- this has been causing problems for a lot of
- people, in rather obscure ways.
-
- * If you use a `boot script <./index.html#boot-script>`_ it will attempt to import ``virtualenv``
- and find a pre-downloaded Setuptools egg using that.
-
- * Added platform-specific paths, like ``/usr/lib/pythonX.Y/plat-linux2``
-
- 1.3.1
- ~~~~~
-
- * Real Python 2.6 compatibility. Backported the Python 2.6 updates to
- ``site.py``, including `user directories
- <http://docs.python.org/dev/whatsnew/2.6.html#pep-370-per-user-site-packages-directory>`_
- (this means older versions of Python will support user directories,
- whether intended or not).
-
- * Always set ``[install] prefix`` in ``distutils.cfg`` -- previously
- on some platforms where a system-wide ``distutils.cfg`` was present
- with a ``prefix`` setting, packages would be installed globally
- (usually in ``/usr/local/lib/pythonX.Y/site-packages``).
-
- * Sometimes Cygwin seems to leave ``.exe`` off ``sys.executable``; a
- workaround is added.
-
- * Fix ``--python`` option.
-
- * Fixed handling of Jython environments that use a
- jython-complete.jar.
-
- 1.3
- ~~~
-
- * Update to Setuptools 0.6c9
- * Added an option ``virtualenv --relocatable EXISTING_ENV``, which
- will make an existing environment "relocatable" -- the paths will
- not be absolute in scripts, ``.egg-info`` and ``.pth`` files. This
- may assist in building environments that can be moved and copied.
- You have to run this *after* any new packages installed.
- * Added ``bin/activate_this.py``, a file you can use like
- ``execfile("path_to/activate_this.py",
- dict(__file__="path_to/activate_this.py"))`` -- this will activate
- the environment in place, similar to what `the mod_wsgi example
- does <http://code.google.com/p/modwsgi/wiki/VirtualEnvironments>`_.
- * For Mac framework builds of Python, the site-packages directory
- ``/Library/Python/X.Y/site-packages`` is added to ``sys.path``, from
- Andrea Rech.
- * Some platform-specific modules in Macs are added to the path now
- (``plat-darwin/``, ``plat-mac/``, ``plat-mac/lib-scriptpackages``),
- from Andrea Rech.
- * Fixed a small Bashism in the ``bin/activate`` shell script.
- * Added ``__future__`` to the list of required modules, for Python
- 2.3. You'll still need to backport your own ``subprocess`` module.
- * Fixed the ``__classpath__`` entry in Jython's ``sys.path`` taking
- precedent over virtualenv's libs.
-
- 1.2
- ~~~
-
- * Added a ``--python`` option to select the Python interpreter.
- * Add ``warnings`` to the modules copied over, for Python 2.6 support.
- * Add ``sets`` to the module copied over for Python 2.3 (though Python
- 2.3 still probably doesn't work).
-
- 1.1.1
- ~~~~~
-
- * Added support for Jython 2.5.
-
- 1.1
- ~~~
-
- * Added support for Python 2.6.
- * Fix a problem with missing ``DLLs/zlib.pyd`` on Windows. Create
- * ``bin/python`` (or ``bin/python.exe``) even when you run virtualenv
- with an interpreter named, e.g., ``python2.4``
- * Fix MacPorts Python
- * Added --unzip-setuptools option
- * Update to Setuptools 0.6c8
- * If the current directory is not writable, run ez_setup.py in ``/tmp``
- * Copy or symlink over the ``include`` directory so that packages will
- more consistently compile.
-
- 1.0
- ~~~
-
- * Fix build on systems that use ``/usr/lib64``, distinct from
- ``/usr/lib`` (specifically CentOS x64).
- * Fixed bug in ``--clear``.
- * Fixed typos in ``deactivate.bat``.
- * Preserve ``$PYTHONPATH`` when calling subprocesses.
-
- 0.9.2
- ~~~~~
-
- * Fix include dir copying on Windows (makes compiling possible).
- * Include the main ``lib-tk`` in the path.
- * Patch ``distutils.sysconfig``: ``get_python_inc`` and
- ``get_python_lib`` to point to the global locations.
- * Install ``distutils.cfg`` before Setuptools, so that system
- customizations of ``distutils.cfg`` won't effect the installation.
- * Add ``bin/pythonX.Y`` to the virtualenv (in addition to
- ``bin/python``).
- * Fixed an issue with Mac Framework Python builds, and absolute paths
- (from Ronald Oussoren).
-
- 0.9.1
- ~~~~~
-
- * Improve ability to create a virtualenv from inside a virtualenv.
- * Fix a little bug in ``bin/activate``.
- * Actually get ``distutils.cfg`` to work reliably.
-
- 0.9
- ~~~
-
- * Added ``lib-dynload`` and ``config`` to things that need to be
- copied over in an environment.
- * Copy over or symlink the ``include`` directory, so that you can
- build packages that need the C headers.
- * Include a ``distutils`` package, so you can locally update
- ``distutils.cfg`` (in ``lib/pythonX.Y/distutils/distutils.cfg``).
- * Better avoid downloading Setuptools, and hitting PyPI on environment
- creation.
- * Fix a problem creating a ``lib64/`` directory.
- * Should work on MacOSX Framework builds (the default Python
- installations on Mac). Thanks to Ronald Oussoren.
-
- 0.8.4
- ~~~~~
-
- * Windows installs would sometimes give errors about ``sys.prefix`` that
- were inaccurate.
- * Slightly prettier output.
-
- 0.8.3
- ~~~~~
-
- * Added support for Windows.
-
- 0.8.2
- ~~~~~
-
- * Give a better warning if you are on an unsupported platform (Mac
- Framework Pythons, and Windows).
- * Give error about running while inside a workingenv.
- * Give better error message about Python 2.3.
-
- 0.8.1
- ~~~~~
-
- Fixed packaging of the library.
-
- 0.8
- ~~~
-
- Initial release. Everything is changed and new!
-
-Keywords: setuptools deployment installation distutils
-Platform: UNKNOWN
-Classifier: Development Status :: 4 - Beta
-Classifier: Intended Audience :: Developers
-Classifier: License :: OSI Approved :: MIT License
-Classifier: Programming Language :: Python :: 2
-Classifier: Programming Language :: Python :: 2.4
-Classifier: Programming Language :: Python :: 2.5
-Classifier: Programming Language :: Python :: 2.6
-Classifier: Programming Language :: Python :: 2.7
-Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3.1
-Classifier: Programming Language :: Python :: 3.2
deleted file mode 100644
--- a/mail/test/resources/virtualenv/docs/index.txt
+++ /dev/null
@@ -1,422 +0,0 @@
-virtualenv
-==========
-
-* `Discussion list <http://groups.google.com/group/python-virtualenv/>`_
-* `Bugs <https://github.com/pypa/virtualenv/issues/>`_
-
-.. contents::
-
-.. toctree::
- :maxdepth: 1
-
- news
-
-.. comment: split here
-
-Status and License
-------------------
-
-``virtualenv`` is a successor to `workingenv
-<http://cheeseshop.python.org/pypi/workingenv.py>`_, and an extension
-of `virtual-python
-<http://peak.telecommunity.com/DevCenter/EasyInstall#creating-a-virtual-python>`_.
-
-It was written by Ian Bicking, sponsored by the `Open Planning
-Project <http://openplans.org>`_ and is now maintained by a
-`group of developers <https://github.com/pypa/virtualenv/raw/master/AUTHORS.txt>`_.
-It is licensed under an
-`MIT-style permissive license <https://github.com/pypa/virtualenv/raw/master/LICENSE.txt>`_.
-
-You can install it with ``easy_install virtualenv``, or from the `git
-repository <https://github.com/pypa/virtualenv>`_ or from a `tarball
-<https://github.com/pypa/virtualenv/tarball/master#egg=virtualenv-dev>`_
-``easy_install virtualenv==dev``.
-
-What It Does
-------------
-
-``virtualenv`` is a tool to create isolated Python environments.
-
-The basic problem being addressed is one of dependencies and versions,
-and indirectly permissions. Imagine you have an application that
-needs version 1 of LibFoo, but another application requires version
-2. How can you use both these applications? If you install
-everything into ``/usr/lib/python2.7/site-packages`` (or whatever your
-platform's standard location is), it's easy to end up in a situation
-where you unintentionally upgrade an application that shouldn't be
-upgraded.
-
-Or more generally, what if you want to install an application *and
-leave it be*? If an application works, any change in its libraries or
-the versions of those libraries can break the application.
-
-Also, what if you can't install packages into the global
-``site-packages`` directory? For instance, on a shared host.
-
-In all these cases, ``virtualenv`` can help you. It creates an
-environment that has its own installation directories, that doesn't
-share libraries with other virtualenv environments (and optionally
-doesn't access the globally installed libraries either).
-
-The basic usage is::
-
- $ python virtualenv.py ENV
-
-If you install it you can also just do ``virtualenv ENV``.
-
-This creates ``ENV/lib/pythonX.X/site-packages``, where any libraries you
-install will go. It also creates ``ENV/bin/python``, which is a Python
-interpreter that uses this environment. Anytime you use that interpreter
-(including when a script has ``#!/path/to/ENV/bin/python`` in it) the libraries
-in that environment will be used.
-
-It also installs either `Setuptools
-<http://peak.telecommunity.com/DevCenter/setuptools>`_ or `distribute
-<http://pypi.python.org/pypi/distribute>`_ into the environment. To use
-Distribute instead of setuptools, just call virtualenv like this::
-
- $ python virtualenv.py --distribute ENV
-
-You can also set the environment variable VIRTUALENV_USE_DISTRIBUTE.
-
-A new virtualenv also includes the `pip <http://pypy.python.org/pypi/pip>`_
-installer, so you can use `ENV/bin/pip`` to install additional packages into
-the environment.
-
-Windows Notes
-~~~~~~~~~~~~~
-
-Some paths within the virtualenv are slightly different on Windows: scripts and
-executables on Windows go in ``ENV\Scripts\`` instead of ``ENV/bin/`` and
-libraries go in ``ENV\Lib\`` rather than ``ENV/lib/``.
-
-To create a virtualenv under a path with spaces in it on Windows, you'll need
-the `win32api <http://sourceforge.net/projects/pywin32/>`_ library installed.
-
-PyPy Support
-~~~~~~~~~~~~
-
-Beginning with virtualenv version 1.5 there is experimental `PyPy
-<http://pypy.org>`_ support. Currently only PyPy trunk is supported.
-
-Creating Your Own Bootstrap Scripts
------------------------------------
-
-While this creates an environment, it doesn't put anything into the
-environment. Developers may find it useful to distribute a script
-that sets up a particular environment, for example a script that
-installs a particular web application.
-
-To create a script like this, call
-``virtualenv.create_bootstrap_script(extra_text)``, and write the
-result to your new bootstrapping script. Here's the documentation
-from the docstring:
-
-Creates a bootstrap script, which is like this script but with
-extend_parser, adjust_options, and after_install hooks.
-
-This returns a string that (written to disk of course) can be used
-as a bootstrap script with your own customizations. The script
-will be the standard virtualenv.py script, with your extra text
-added (your extra text should be Python code).
-
-If you include these functions, they will be called:
-
-``extend_parser(optparse_parser)``:
- You can add or remove options from the parser here.
-
-``adjust_options(options, args)``:
- You can change options here, or change the args (if you accept
- different kinds of arguments, be sure you modify ``args`` so it is
- only ``[DEST_DIR]``).
-
-``after_install(options, home_dir)``:
-
- After everything is installed, this function is called. This
- is probably the function you are most likely to use. An
- example would be::
-
- def after_install(options, home_dir):
- if sys.platform == 'win32':
- bin = 'Scripts'
- else:
- bin = 'bin'
- subprocess.call([join(home_dir, bin, 'easy_install'),
- 'MyPackage'])
- subprocess.call([join(home_dir, bin, 'my-package-script'),
- 'setup', home_dir])
-
- This example immediately installs a package, and runs a setup
- script from that package.
-
-Bootstrap Example
-~~~~~~~~~~~~~~~~~
-
-Here's a more concrete example of how you could use this::
-
- import virtualenv, textwrap
- output = virtualenv.create_bootstrap_script(textwrap.dedent("""
- import os, subprocess
- def after_install(options, home_dir):
- etc = join(home_dir, 'etc')
- if not os.path.exists(etc):
- os.makedirs(etc)
- subprocess.call([join(home_dir, 'bin', 'easy_install'),
- 'BlogApplication'])
- subprocess.call([join(home_dir, 'bin', 'paster'),
- 'make-config', 'BlogApplication',
- join(etc, 'blog.ini')])
- subprocess.call([join(home_dir, 'bin', 'paster'),
- 'setup-app', join(etc, 'blog.ini')])
- """))
- f = open('blog-bootstrap.py', 'w').write(output)
-
-Another example is available `here
-<https://svn.openplans.org/svn/fassembler/trunk/fassembler/create-venv-script.py>`_.
-
-activate script
-~~~~~~~~~~~~~~~
-
-In a newly created virtualenv there will be a ``bin/activate`` shell
-script, or a ``Scripts/activate.bat`` batch file on Windows.
-
-On Posix systems you can do::
-
- $ source bin/activate
-
-This will change your ``$PATH`` to point to the virtualenv's ``bin/``
-directory. (You have to use ``source`` because it changes your shell
-environment in-place.) This is all it does; it's purely a convenience. If
-you directly run a script or the python interpreter from the virtualenv's
-``bin/`` directory (e.g. ``path/to/env/bin/pip`` or
-``/path/to/env/bin/python script.py``) there's no need for activation.
-
-After activating an environment you can use the function ``deactivate`` to
-undo the changes to your ``$PATH``.
-
-The ``activate`` script will also modify your shell prompt to indicate
-which environment is currently active. You can disable this behavior,
-which can be useful if you have your own custom prompt that already
-displays the active environment name. To do so, set the
-``VIRTUAL_ENV_DISABLE_PROMPT`` environment variable to any non-empty
-value before running the ``activate`` script.
-
-On Windows you just do::
-
- > \path\to\env\bin\activate.bat
-
-And use ``deactivate.bat`` to undo the changes.
-
-The ``--no-site-packages`` Option
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-If you build with ``virtualenv --no-site-packages ENV`` it will *not*
-inherit any packages from ``/usr/lib/python2.5/site-packages`` (or
-wherever your global site-packages directory is). This can be used if
-you don't have control over site-packages and don't want to depend on
-the packages there, or you just want more isolation from the global
-system.
-
-Using Virtualenv without ``bin/python``
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-Sometimes you can't or don't want to use the Python interpreter
-created by the virtualenv. For instance, in a `mod_python
-<http://www.modpython.org/>`_ or `mod_wsgi <http://www.modwsgi.org/>`_
-environment, there is only one interpreter.
-
-Luckily, it's easy. You must use the custom Python interpreter to
-*install* libraries. But to *use* libraries, you just have to be sure
-the path is correct. A script is available to correct the path. You
-can setup the environment like::
-
- activate_this = '/path/to/env/bin/activate_this.py'
- execfile(activate_this, dict(__file__=activate_this))
-
-This will change ``sys.path`` and even change ``sys.prefix``, but also allow
-you to use an existing interpreter. Items in your environment will show up
-first on ``sys.path``, before global items. However, global items will
-always be accessible -- this technique does not support the
-``--no-site-packages`` flag. Also, this cannot undo the activation of other
-environments, or modules that have been imported. You shouldn't try to, for
-instance, activate an environment before a web request; you should activate
-*one* environment as early as possible, and not do it again in that process.
-
-Making Environments Relocatable
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-Note: this option is somewhat experimental, and there are probably
-caveats that have not yet been identified. Also this does not
-currently work on Windows.
-
-Normally environments are tied to a specific path. That means that
-you cannot move an environment around or copy it to another computer.
-You can fix up an environment to make it relocatable with the
-command::
-
- $ virtualenv --relocatable ENV
-
-This will make some of the files created by setuptools or distribute
-use relative paths, and will change all the scripts to use ``activate_this.py``
-instead of using the location of the Python interpreter to select the
-environment.
-
-**Note:** you must run this after you've installed *any* packages into
-the environment. If you make an environment relocatable, then
-install a new package, you must run ``virtualenv --relocatable``
-again.
-
-Also, this **does not make your packages cross-platform**. You can
-move the directory around, but it can only be used on other similar
-computers. Some known environmental differences that can cause
-incompatibilities: a different version of Python, when one platform
-uses UCS2 for its internal unicode representation and another uses
-UCS4 (a compile-time option), obvious platform changes like Windows
-vs. Linux, or Intel vs. ARM, and if you have libraries that bind to C
-libraries on the system, if those C libraries are located somewhere
-different (either different versions, or a different filesystem
-layout).
-
-Currently the ``--no-site-packages`` option will not be honored if you
-use this on an environment.
-
-The ``--extra-search-dir`` Option
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-When it creates a new environment, virtualenv installs either
-setuptools or distribute, and pip. In normal operation, the latest
-releases of these packages are fetched from the `Python Package Index
-<http://pypi.python.org>`_ (PyPI). In some circumstances, this
-behavior may not be wanted, for example if you are using virtualenv
-during a deployment and do not want to depend on Internet access and
-PyPI availability.
-
-As an alternative, you can provide your own versions of setuptools,
-distribute and/or pip on the filesystem, and tell virtualenv to use
-those distributions instead of downloading them from the Internet. To
-use this feature, pass one or more ``--extra-search-dir`` options to
-virtualenv like this::
-
- $ virtualenv --extra-search-dir=/path/to/distributions ENV
-
-The ``/path/to/distributions`` path should point to a directory that
-contains setuptools, distribute and/or pip distributions. Setuptools
-distributions must be ``.egg`` files; distribute and pip distributions
-should be `.tar.gz` source distributions.
-
-Virtualenv will still download these packages if no satisfactory local
-distributions are found.
-
-If you are really concerned about virtualenv fetching these packages
-from the Internet and want to ensure that it never will, you can also
-provide an option ``--never-download`` like so::
-
- $ virtualenv --extra-search-dir=/path/to/distributions --never-download ENV
-
-If this option is provided, virtualenv will never try to download
-setuptools/distribute or pip. Instead, it will exit with status code 1
-if it fails to find local distributions for any of these required
-packages.
-
-Compare & Contrast with Alternatives
-------------------------------------
-
-There are several alternatives that create isolated environments:
-
-* ``workingenv`` (which I do not suggest you use anymore) is the
- predecessor to this library. It used the main Python interpreter,
- but relied on setting ``$PYTHONPATH`` to activate the environment.
- This causes problems when running Python scripts that aren't part of
- the environment (e.g., a globally installed ``hg`` or ``bzr``). It
- also conflicted a lot with Setuptools.
-
-* `virtual-python
- <http://peak.telecommunity.com/DevCenter/EasyInstall#creating-a-virtual-python>`_
- is also a predecessor to this library. It uses only symlinks, so it
- couldn't work on Windows. It also symlinks over the *entire*
- standard library and global ``site-packages``. As a result, it
- won't see new additions to the global ``site-packages``.
-
- This script only symlinks a small portion of the standard library
- into the environment, and so on Windows it is feasible to simply
- copy these files over. Also, it creates a new/empty
- ``site-packages`` and also adds the global ``site-packages`` to the
- path, so updates are tracked separately. This script also installs
- Setuptools automatically, saving a step and avoiding the need for
- network access.
-
-* `zc.buildout <http://pypi.python.org/pypi/zc.buildout>`_ doesn't
- create an isolated Python environment in the same style, but
- achieves similar results through a declarative config file that sets
- up scripts with very particular packages. As a declarative system,
- it is somewhat easier to repeat and manage, but more difficult to
- experiment with. ``zc.buildout`` includes the ability to setup
- non-Python systems (e.g., a database server or an Apache instance).
-
-I *strongly* recommend anyone doing application development or
-deployment use one of these tools.
-
-Contributing
-------------
-
-Refer to the `contributing to pip`_ documentation - it applies equally to
-virtualenv.
-
-Virtualenv's release schedule is tied to pip's -- each time there's a new pip
-release, there will be a new virtualenv release that bundles the new version of
-pip.
-
-.. _contributing to pip: http://www.pip-installer.org/en/latest/how-to-contribute.html
-
-Running the tests
-~~~~~~~~~~~~~~~~~
-
-Virtualenv's test suite is small and not yet at all comprehensive, but we aim
-to grow it.
-
-The easy way to run tests (handles test dependencies automatically)::
-
- $ python setup.py test
-
-If you want to run only a selection of the tests, you'll need to run them
-directly with nose instead. Create a virtualenv, and install required
-packages::
-
- $ pip install nose mock
-
-Run nosetests::
-
- $ nosetests
-
-Or select just a single test file to run::
-
- $ nosetests tests.test_virtualenv
-
-
-Other Documentation and Links
------------------------------
-
-* James Gardner has written a tutorial on using `virtualenv with
- Pylons
- <http://wiki.pylonshq.com/display/pylonscookbook/Using+a+Virtualenv+Sandbox>`_.
-
-* `Blog announcement
- <http://blog.ianbicking.org/2007/10/10/workingenv-is-dead-long-live-virtualenv/>`_.
-
-* Doug Hellmann wrote a description of his `command-line work flow
- using virtualenv (virtualenvwrapper)
- <http://www.doughellmann.com/articles/CompletelyDifferent-2008-05-virtualenvwrapper/index.html>`_
- including some handy scripts to make working with multiple
- environments easier. He also wrote `an example of using virtualenv
- to try IPython
- <http://www.doughellmann.com/articles/CompletelyDifferent-2008-02-ipython-and-virtualenv/index.html>`_.
-
-* Chris Perkins created a `showmedo video including virtualenv
- <http://showmedo.com/videos/video?name=2910000&fromSeriesID=291>`_.
-
-* `Using virtualenv with mod_wsgi
- <http://code.google.com/p/modwsgi/wiki/VirtualEnvironments>`_.
-
-* `virtualenv commands
- <http://thisismedium.com/tech/extending-virtualenv/>`_ for some more
- workflow-related tools around virtualenv.
deleted file mode 100644
--- a/mail/test/resources/virtualenv/docs/news.txt
+++ /dev/null
@@ -1,366 +0,0 @@
-Changes & News
---------------
-
-Next release (1.7) schedule
-~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-Beta release mid-July 2011, final release early August.
-
-
-1.6.1 (2011-04-30)
-~~~~~~~~~~~~~~~~~~
-
-* Start to use git-flow.
-
-* Added support for PyPy 1.5
-
-* Fixed #121 -- added sanity-checking of the -p argument. Thanks Paul Nasrat.
-
-* Added progress meter for pip installation as well as setuptools. Thanks Ethan
- Jucovy.
-
-* Added --never-download and --search-dir options. Thanks Ethan Jucovy.
-
-1.6
-~~~
-
-* Added Python 3 support! Huge thanks to Vinay Sajip and Vitaly Babiy.
-
-* Fixed creation of virtualenvs on Mac OS X when standard library modules
- (readline) are installed outside the standard library.
-
-* Updated bundled pip to 1.0.
-
-1.5.2
-~~~~~
-
-* Moved main repository to Github: https://github.com/pypa/virtualenv
-
-* Transferred primary maintenance from Ian to Jannis Leidel, Carl Meyer and Brian Rosner
-
-* Fixed a few more pypy related bugs.
-
-* Updated bundled pip to 0.8.2.
-
-* Handed project over to new team of maintainers.
-
-* Moved virtualenv to Github at https://github.com/pypa/virtualenv
-
-1.5.1
-~~~~~
-
-* Added ``_weakrefset`` requirement for Python 2.7.1.
-
-* Fixed Windows regression in 1.5
-
-1.5
-~~~
-
-* Include pip 0.8.1.
-
-* Add support for PyPy.
-
-* Uses a proper temporary dir when installing environment requirements.
-
-* Add ``--prompt`` option to be able to override the default prompt prefix.
-
-* Fix an issue with ``--relocatable`` on Windows.
-
-* Fix issue with installing the wrong version of distribute.
-
-* Add fish and csh activate scripts.
-
-1.4.9
-~~~~~
-
-* Include pip 0.7.2
-
-1.4.8
-~~~~~
-
-* Fix for Mac OS X Framework builds that use
- ``--universal-archs=intel``
-
-* Fix ``activate_this.py`` on Windows.
-
-* Allow ``$PYTHONHOME`` to be set, so long as you use ``source
- bin/activate`` it will get unset; if you leave it set and do not
- activate the environment it will still break the environment.
-
-* Include pip 0.7.1
-
-1.4.7
-~~~~~
-
-* Include pip 0.7
-
-1.4.6
-~~~~~
-
-* Allow ``activate.sh`` to skip updating the prompt (by setting
- ``$VIRTUAL_ENV_DISABLE_PROMPT``).
-
-1.4.5
-~~~~~
-
-* Include pip 0.6.3
-
-* Fix ``activate.bat`` and ``deactivate.bat`` under Windows when
- ``PATH`` contained a parenthesis
-
-1.4.4
-~~~~~
-
-* Include pip 0.6.2 and Distribute 0.6.10
-
-* Create the ``virtualenv`` script even when Setuptools isn't
- installed
-
-* Fix problem with ``virtualenv --relocate`` when ``bin/`` has
- subdirectories (e.g., ``bin/.svn/``); from Alan Franzoni.
-
-* If you set ``$VIRTUALENV_USE_DISTRIBUTE`` then virtualenv will use
- Distribute by default (so you don't have to remember to use
- ``--distribute``).
-
-1.4.3
-~~~~~
-
-* Include pip 0.6.1
-
-1.4.2
-~~~~~
-
-* Fix pip installation on Windows
-
-* Fix use of stand-alone ``virtualenv.py`` (and boot scripts)
-
-* Exclude ~/.local (user site-packages) from environments when using
- ``--no-site-packages``
-
-1.4.1
-~~~~~
-
-* Include pip 0.6
-
-1.4
-~~~
-
-* Updated setuptools to 0.6c11
-
-* Added the --distribute option
-
-* Fixed packaging problem of support-files
-
-1.3.4
-~~~~~
-
-* Virtualenv now copies the actual embedded Python binary on
- Mac OS X to fix a hang on Snow Leopard (10.6).
-
-* Fail more gracefully on Windows when ``win32api`` is not installed.
-
-* Fix site-packages taking precedent over Jython's ``__classpath__``
- and also specially handle the new ``__pyclasspath__`` entry in
- ``sys.path``.
-
-* Now copies Jython's ``registry`` file to the virtualenv if it exists.
-
-* Better find libraries when compiling extensions on Windows.
-
-* Create ``Scripts\pythonw.exe`` on Windows.
-
-* Added support for the Debian/Ubuntu
- ``/usr/lib/pythonX.Y/dist-packages`` directory.
-
-* Set ``distutils.sysconfig.get_config_vars()['LIBDIR']`` (based on
- ``sys.real_prefix``) which is reported to help building on Windows.
-
-* Make ``deactivate`` work on ksh
-
-* Fixes for ``--python``: make it work with ``--relocatable`` and the
- symlink created to the exact Python version.
-
-1.3.3
-~~~~~
-
-* Use Windows newlines in ``activate.bat``, which has been reported to help
- when using non-ASCII directory names.
-
-* Fixed compatibility with Jython 2.5b1.
-
-* Added a function ``virtualenv.install_python`` for more fine-grained
- access to what ``virtualenv.create_environment`` does.
-
-* Fix `a problem <https://bugs.launchpad.net/virtualenv/+bug/241581>`_
- with Windows and paths that contain spaces.
-
-* If ``/path/to/env/.pydistutils.cfg`` exists (or
- ``/path/to/env/pydistutils.cfg`` on Windows systems) then ignore
- ``~/.pydistutils.cfg`` and use that other file instead.
-
-* Fix ` a problem
- <https://bugs.launchpad.net/virtualenv/+bug/340050>`_ picking up
- some ``.so`` libraries in ``/usr/local``.
-
-1.3.2
-~~~~~
-
-* Remove the ``[install] prefix = ...`` setting from the virtualenv
- ``distutils.cfg`` -- this has been causing problems for a lot of
- people, in rather obscure ways.
-
-* If you use a `boot script <./index.html#boot-script>`_ it will attempt to import ``virtualenv``
- and find a pre-downloaded Setuptools egg using that.
-
-* Added platform-specific paths, like ``/usr/lib/pythonX.Y/plat-linux2``
-
-1.3.1
-~~~~~
-
-* Real Python 2.6 compatibility. Backported the Python 2.6 updates to
- ``site.py``, including `user directories
- <http://docs.python.org/dev/whatsnew/2.6.html#pep-370-per-user-site-packages-directory>`_
- (this means older versions of Python will support user directories,
- whether intended or not).
-
-* Always set ``[install] prefix`` in ``distutils.cfg`` -- previously
- on some platforms where a system-wide ``distutils.cfg`` was present
- with a ``prefix`` setting, packages would be installed globally
- (usually in ``/usr/local/lib/pythonX.Y/site-packages``).
-
-* Sometimes Cygwin seems to leave ``.exe`` off ``sys.executable``; a
- workaround is added.
-
-* Fix ``--python`` option.
-
-* Fixed handling of Jython environments that use a
- jython-complete.jar.
-
-1.3
-~~~
-
-* Update to Setuptools 0.6c9
-* Added an option ``virtualenv --relocatable EXISTING_ENV``, which
- will make an existing environment "relocatable" -- the paths will
- not be absolute in scripts, ``.egg-info`` and ``.pth`` files. This
- may assist in building environments that can be moved and copied.
- You have to run this *after* any new packages installed.
-* Added ``bin/activate_this.py``, a file you can use like
- ``execfile("path_to/activate_this.py",
- dict(__file__="path_to/activate_this.py"))`` -- this will activate
- the environment in place, similar to what `the mod_wsgi example
- does <http://code.google.com/p/modwsgi/wiki/VirtualEnvironments>`_.
-* For Mac framework builds of Python, the site-packages directory
- ``/Library/Python/X.Y/site-packages`` is added to ``sys.path``, from
- Andrea Rech.
-* Some platform-specific modules in Macs are added to the path now
- (``plat-darwin/``, ``plat-mac/``, ``plat-mac/lib-scriptpackages``),
- from Andrea Rech.
-* Fixed a small Bashism in the ``bin/activate`` shell script.
-* Added ``__future__`` to the list of required modules, for Python
- 2.3. You'll still need to backport your own ``subprocess`` module.
-* Fixed the ``__classpath__`` entry in Jython's ``sys.path`` taking
- precedent over virtualenv's libs.
-
-1.2
-~~~
-
-* Added a ``--python`` option to select the Python interpreter.
-* Add ``warnings`` to the modules copied over, for Python 2.6 support.
-* Add ``sets`` to the module copied over for Python 2.3 (though Python
- 2.3 still probably doesn't work).
-
-1.1.1
-~~~~~
-
-* Added support for Jython 2.5.
-
-1.1
-~~~
-
-* Added support for Python 2.6.
-* Fix a problem with missing ``DLLs/zlib.pyd`` on Windows. Create
-* ``bin/python`` (or ``bin/python.exe``) even when you run virtualenv
- with an interpreter named, e.g., ``python2.4``
-* Fix MacPorts Python
-* Added --unzip-setuptools option
-* Update to Setuptools 0.6c8
-* If the current directory is not writable, run ez_setup.py in ``/tmp``
-* Copy or symlink over the ``include`` directory so that packages will
- more consistently compile.
-
-1.0
-~~~
-
-* Fix build on systems that use ``/usr/lib64``, distinct from
- ``/usr/lib`` (specifically CentOS x64).
-* Fixed bug in ``--clear``.
-* Fixed typos in ``deactivate.bat``.
-* Preserve ``$PYTHONPATH`` when calling subprocesses.
-
-0.9.2
-~~~~~
-
-* Fix include dir copying on Windows (makes compiling possible).
-* Include the main ``lib-tk`` in the path.
-* Patch ``distutils.sysconfig``: ``get_python_inc`` and
- ``get_python_lib`` to point to the global locations.
-* Install ``distutils.cfg`` before Setuptools, so that system
- customizations of ``distutils.cfg`` won't effect the installation.
-* Add ``bin/pythonX.Y`` to the virtualenv (in addition to
- ``bin/python``).
-* Fixed an issue with Mac Framework Python builds, and absolute paths
- (from Ronald Oussoren).
-
-0.9.1
-~~~~~
-
-* Improve ability to create a virtualenv from inside a virtualenv.
-* Fix a little bug in ``bin/activate``.
-* Actually get ``distutils.cfg`` to work reliably.
-
-0.9
-~~~
-
-* Added ``lib-dynload`` and ``config`` to things that need to be
- copied over in an environment.
-* Copy over or symlink the ``include`` directory, so that you can
- build packages that need the C headers.
-* Include a ``distutils`` package, so you can locally update
- ``distutils.cfg`` (in ``lib/pythonX.Y/distutils/distutils.cfg``).
-* Better avoid downloading Setuptools, and hitting PyPI on environment
- creation.
-* Fix a problem creating a ``lib64/`` directory.
-* Should work on MacOSX Framework builds (the default Python
- installations on Mac). Thanks to Ronald Oussoren.
-
-0.8.4
-~~~~~
-
-* Windows installs would sometimes give errors about ``sys.prefix`` that
- were inaccurate.
-* Slightly prettier output.
-
-0.8.3
-~~~~~
-
-* Added support for Windows.
-
-0.8.2
-~~~~~
-
-* Give a better warning if you are on an unsupported platform (Mac
- Framework Pythons, and Windows).
-* Give error about running while inside a workingenv.
-* Give better error message about Python 2.3.
-
-0.8.1
-~~~~~
-
-Fixed packaging of the library.
-
-0.8
-~~~
-
-Initial release. Everything is changed and new!
deleted file mode 100644
--- a/mail/test/resources/virtualenv/scripts/virtualenv
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/usr/bin/env python
-import virtualenv
-virtualenv.main()
deleted file mode 100644
--- a/mail/test/resources/virtualenv/setup.cfg
+++ /dev/null
@@ -1,5 +0,0 @@
-[egg_info]
-tag_build =
-tag_date = 0
-tag_svn_revision = 0
-
deleted file mode 100644
--- a/mail/test/resources/virtualenv/setup.py
+++ /dev/null
@@ -1,58 +0,0 @@
-import sys, os
-try:
- from setuptools import setup
- kw = {'entry_points':
- """[console_scripts]\nvirtualenv = virtualenv:main\n""",
- 'zip_safe': False}
-except ImportError:
- from distutils.core import setup
- if sys.platform == 'win32':
- print('Note: without Setuptools installed you will have to use "python -m virtualenv ENV"')
- kw = {}
- else:
- kw = {'scripts': ['scripts/virtualenv']}
-
-here = os.path.dirname(os.path.abspath(__file__))
-
-## Get long_description from index.txt:
-f = open(os.path.join(here, 'docs', 'index.txt'))
-long_description = f.read().strip()
-long_description = long_description.split('split here', 1)[1]
-f.close()
-f = open(os.path.join(here, 'docs', 'news.txt'))
-long_description += "\n\n" + f.read()
-f.close()
-
-setup(name='virtualenv',
- # If you change the version here, change it in virtualenv.py and
- # docs/conf.py as well
- version="1.6.1",
- description="Virtual Python Environment builder",
- long_description=long_description,
- classifiers=[
- 'Development Status :: 4 - Beta',
- 'Intended Audience :: Developers',
- 'License :: OSI Approved :: MIT License',
- 'Programming Language :: Python :: 2',
- 'Programming Language :: Python :: 2.4',
- 'Programming Language :: Python :: 2.5',
- 'Programming Language :: Python :: 2.6',
- 'Programming Language :: Python :: 2.7',
- 'Programming Language :: Python :: 3',
- 'Programming Language :: Python :: 3.1',
- 'Programming Language :: Python :: 3.2',
- ],
- keywords='setuptools deployment installation distutils',
- author='Ian Bicking',
- author_email='ianb@colorstudy.com',
- maintainer='Jannis Leidel, Carl Meyer and Brian Rosner',
- maintainer_email='python-virtualenv@groups.google.com',
- url='http://www.virtualenv.org',
- license='MIT',
- py_modules=['virtualenv'],
- packages=['virtualenv_support'],
- package_data={'virtualenv_support': ['*-py%s.egg' % sys.version[:3], '*.tar.gz']},
- test_suite='nose.collector',
- tests_require=['nose', 'Mock'],
- **kw
- )
deleted file mode 100644
--- a/mail/test/resources/virtualenv/virtualenv.py
+++ /dev/null
@@ -1,1969 +0,0 @@
-#!/usr/bin/env python
-"""Create a "virtual" Python installation
-"""
-
-# If you change the version here, change it in setup.py
-# and docs/conf.py as well.
-virtualenv_version = "1.6.1"
-
-import base64
-import sys
-import os
-import optparse
-import re
-import shutil
-import logging
-import tempfile
-import zlib
-import errno
-import distutils.sysconfig
-try:
- import subprocess
-except ImportError:
- if sys.version_info <= (2, 3):
- print('ERROR: %s' % sys.exc_info()[1])
- print('ERROR: this script requires Python 2.4 or greater; or at least the subprocess module.')
- print('If you copy subprocess.py from a newer version of Python this script will probably work')
- sys.exit(101)
- else:
- raise
-try:
- set
-except NameError:
- from sets import Set as set
-try:
- basestring
-except NameError:
- basestring = str
-
-join = os.path.join
-py_version = 'python%s.%s' % (sys.version_info[0], sys.version_info[1])
-
-is_jython = sys.platform.startswith('java')
-is_pypy = hasattr(sys, 'pypy_version_info')
-abiflags = getattr(sys, 'abiflags', '')
-
-if is_pypy:
- expected_exe = 'pypy'
-elif is_jython:
- expected_exe = 'jython'
-else:
- expected_exe = 'python'
-
-
-REQUIRED_MODULES = ['os', 'posix', 'posixpath', 'nt', 'ntpath', 'genericpath',
- 'fnmatch', 'locale', 'encodings', 'codecs',
- 'stat', 'UserDict', 'readline', 'copy_reg', 'types',
- 're', 'sre', 'sre_parse', 'sre_constants', 'sre_compile',
- 'zlib']
-
-REQUIRED_FILES = ['lib-dynload', 'config']
-
-majver, minver = sys.version_info[:2]
-if majver == 2:
- if minver >= 6:
- REQUIRED_MODULES.extend(['warnings', 'linecache', '_abcoll', 'abc'])
- if minver >= 7:
- REQUIRED_MODULES.extend(['_weakrefset'])
- if minver <= 3:
- REQUIRED_MODULES.extend(['sets', '__future__'])
-elif majver == 3:
- # Some extra modules are needed for Python 3, but different ones
- # for different versions.
- REQUIRED_MODULES.extend(['_abcoll', 'warnings', 'linecache', 'abc', 'io',
- '_weakrefset', 'copyreg', 'tempfile', 'random',
- '__future__', 'collections', 'keyword', 'tarfile',
- 'shutil', 'struct', 'copy'])
- if minver >= 2:
- REQUIRED_FILES[-1] = 'config-%s' % majver
- if minver == 3:
- # The whole list of 3.3 modules is reproduced below - the current
- # uncommented ones are required for 3.3 as of now, but more may be
- # added as 3.3 development continues.
- REQUIRED_MODULES.extend([
- #"aifc",
- #"antigravity",
- #"argparse",
- #"ast",
- #"asynchat",
- #"asyncore",
- "base64",
- #"bdb",
- #"binhex",
- "bisect",
- #"calendar",
- #"cgi",
- #"cgitb",
- #"chunk",
- #"cmd",
- #"codeop",
- #"code",
- #"colorsys",
- #"_compat_pickle",
- #"compileall",
- #"concurrent",
- #"configparser",
- #"contextlib",
- #"cProfile",
- #"crypt",
- #"csv",
- #"ctypes",
- #"curses",
- #"datetime",
- #"dbm",
- #"decimal",
- #"difflib",
- #"dis",
- #"doctest",
- #"dummy_threading",
- #"_dummy_thread",
- #"email",
- #"filecmp",
- #"fileinput",
- #"formatter",
- #"fractions",
- #"ftplib",
- #"functools",
- #"getopt",
- #"getpass",
- #"gettext",
- #"glob",
- #"gzip",
- "hashlib",
- "heapq",
- "hmac",
- #"html",
- #"http",
- #"idlelib",
- #"imaplib",
- #"imghdr",
- #"importlib",
- #"inspect",
- #"json",
- #"lib2to3",
- #"logging",
- #"macpath",
- #"macurl2path",
- #"mailbox",
- #"mailcap",
- #"_markupbase",
- #"mimetypes",
- #"modulefinder",
- #"multiprocessing",
- #"netrc",
- #"nntplib",
- #"nturl2path",
- #"numbers",
- #"opcode",
- #"optparse",
- #"os2emxpath",
- #"pdb",
- #"pickle",
- #"pickletools",
- #"pipes",
- #"pkgutil",
- #"platform",
- #"plat-linux2",
- #"plistlib",
- #"poplib",
- #"pprint",
- #"profile",
- #"pstats",
- #"pty",
- #"pyclbr",
- #"py_compile",
- #"pydoc_data",
- #"pydoc",
- #"_pyio",
- #"queue",
- #"quopri",
- "reprlib",
- "rlcompleter",
- #"runpy",
- #"sched",
- #"shelve",
- #"shlex",
- #"smtpd",
- #"smtplib",
- #"sndhdr",
- #"socket",
- #"socketserver",
- #"sqlite3",
- #"ssl",
- #"stringprep",
- #"string",
- #"_strptime",
- #"subprocess",
- #"sunau",
- #"symbol",
- #"symtable",
- #"sysconfig",
- #"tabnanny",
- #"telnetlib",
- #"test",
- #"textwrap",
- #"this",
- #"_threading_local",
- #"threading",
- #"timeit",
- #"tkinter",
- #"tokenize",
- #"token",
- #"traceback",
- #"trace",
- #"tty",
- #"turtledemo",
- #"turtle",
- #"unittest",
- #"urllib",
- #"uuid",
- #"uu",
- #"wave",
- "weakref",
- #"webbrowser",
- #"wsgiref",
- #"xdrlib",
- #"xml",
- #"xmlrpc",
- #"zipfile",
- ])
-
-if is_pypy:
- # these are needed to correctly display the exceptions that may happen
- # during the bootstrap
- REQUIRED_MODULES.extend(['traceback', 'linecache'])
-
-class Logger(object):
-
- """
- Logging object for use in command-line script. Allows ranges of
- levels, to avoid some redundancy of displayed information.
- """
-
- DEBUG = logging.DEBUG
- INFO = logging.INFO
- NOTIFY = (logging.INFO+logging.WARN)/2
- WARN = WARNING = logging.WARN
- ERROR = logging.ERROR
- FATAL = logging.FATAL
-
- LEVELS = [DEBUG, INFO, NOTIFY, WARN, ERROR, FATAL]
-
- def __init__(self, consumers):
- self.consumers = consumers
- self.indent = 0
- self.in_progress = None
- self.in_progress_hanging = False
-
- def debug(self, msg, *args, **kw):
- self.log(self.DEBUG, msg, *args, **kw)
- def info(self, msg, *args, **kw):
- self.log(self.INFO, msg, *args, **kw)
- def notify(self, msg, *args, **kw):
- self.log(self.NOTIFY, msg, *args, **kw)
- def warn(self, msg, *args, **kw):
- self.log(self.WARN, msg, *args, **kw)
- def error(self, msg, *args, **kw):
- self.log(self.WARN, msg, *args, **kw)
- def fatal(self, msg, *args, **kw):
- self.log(self.FATAL, msg, *args, **kw)
- def log(self, level, msg, *args, **kw):
- if args:
- if kw:
- raise TypeError(
- "You may give positional or keyword arguments, not both")
- args = args or kw
- rendered = None
- for consumer_level, consumer in self.consumers:
- if self.level_matches(level, consumer_level):
- if (self.in_progress_hanging
- and consumer in (sys.stdout, sys.stderr)):
- self.in_progress_hanging = False
- sys.stdout.write('\n')
- sys.stdout.flush()
- if rendered is None:
- if args:
- rendered = msg % args
- else:
- rendered = msg
- rendered = ' '*self.indent + rendered
- if hasattr(consumer, 'write'):
- consumer.write(rendered+'\n')
- else:
- consumer(rendered)
-
- def start_progress(self, msg):
- assert not self.in_progress, (
- "Tried to start_progress(%r) while in_progress %r"
- % (msg, self.in_progress))
- if self.level_matches(self.NOTIFY, self._stdout_level()):
- sys.stdout.write(msg)
- sys.stdout.flush()
- self.in_progress_hanging = True
- else:
- self.in_progress_hanging = False
- self.in_progress = msg
-
- def end_progress(self, msg='done.'):
- assert self.in_progress, (
- "Tried to end_progress without start_progress")
- if self.stdout_level_matches(self.NOTIFY):
- if not self.in_progress_hanging:
- # Some message has been printed out since start_progress
- sys.stdout.write('...' + self.in_progress + msg + '\n')
- sys.stdout.flush()
- else:
- sys.stdout.write(msg + '\n')
- sys.stdout.flush()
- self.in_progress = None
- self.in_progress_hanging = False
-
- def show_progress(self):
- """If we are in a progress scope, and no log messages have been
- shown, write out another '.'"""
- if self.in_progress_hanging:
- sys.stdout.write('.')
- sys.stdout.flush()
-
- def stdout_level_matches(self, level):
- """Returns true if a message at this level will go to stdout"""
- return self.level_matches(level, self._stdout_level())
-
- def _stdout_level(self):
- """Returns the level that stdout runs at"""
- for level, consumer in self.consumers:
- if consumer is sys.stdout:
- return level
- return self.FATAL
-
- def level_matches(self, level, consumer_level):
- """
- >>> l = Logger()
- >>> l.level_matches(3, 4)
- False
- >>> l.level_matches(3, 2)
- True
- >>> l.level_matches(slice(None, 3), 3)
- False
- >>> l.level_matches(slice(None, 3), 2)
- True
- >>> l.level_matches(slice(1, 3), 1)
- True
- >>> l.level_matches(slice(2, 3), 1)
- False
- """
- if isinstance(level, slice):
- start, stop = level.start, level.stop
- if start is not None and start > consumer_level:
- return False
- if stop is not None or stop <= consumer_level:
- return False
- return True
- else:
- return level >= consumer_level
-
- #@classmethod
- def level_for_integer(cls, level):
- levels = cls.LEVELS
- if level < 0:
- return levels[0]
- if level >= len(levels):
- return levels[-1]
- return levels[level]
-
- level_for_integer = classmethod(level_for_integer)
-
-# create a silent logger just to prevent this from being undefined
-# will be overridden with requested verbosity main() is called.
-logger = Logger([(Logger.LEVELS[-1], sys.stdout)])
-
-def mkdir(path):
- if not os.path.exists(path):
- logger.info('Creating %s', path)
- os.makedirs(path)
- else:
- logger.info('Directory %s already exists', path)
-
-def copyfileordir(src, dest):
- if os.path.isdir(src):
- shutil.copytree(src, dest, True)
- else:
- shutil.copy2(src, dest)
-
-def copyfile(src, dest, symlink=True):
- if not os.path.exists(src):
- # Some bad symlink in the src
- logger.warn('Cannot find file %s (bad symlink)', src)
- return
- if os.path.exists(dest):
- logger.debug('File %s already exists', dest)
- return
- if not os.path.exists(os.path.dirname(dest)):
- logger.info('Creating parent directories for %s' % os.path.dirname(dest))
- os.makedirs(os.path.dirname(dest))
- if not os.path.islink(src):
- srcpath = os.path.abspath(src)
- else:
- srcpath = os.readlink(src)
- if symlink and hasattr(os, 'symlink'):
- logger.info('Symlinking %s', dest)
- try:
- os.symlink(srcpath, dest)
- except (OSError, NotImplementedError):
- logger.info('Symlinking failed, copying to %s', dest)
- copyfileordir(src, dest)
- else:
- logger.info('Copying to %s', dest)
- copyfileordir(src, dest)
-
-def writefile(dest, content, overwrite=True):
- if not os.path.exists(dest):
- logger.info('Writing %s', dest)
- f = open(dest, 'wb')
- f.write(content.encode('utf-8'))
- f.close()
- return
- else:
- f = open(dest, 'rb')
- c = f.read()
- f.close()
- if c != content:
- if not overwrite:
- logger.notify('File %s exists with different content; not overwriting', dest)
- return
- logger.notify('Overwriting %s with new content', dest)
- f = open(dest, 'wb')
- f.write(content.encode('utf-8'))
- f.close()
- else:
- logger.info('Content %s already in place', dest)
-
-def rmtree(dir):
- if os.path.exists(dir):
- logger.notify('Deleting tree %s', dir)
- shutil.rmtree(dir)
- else:
- logger.info('Do not need to delete %s; already gone', dir)
-
-def make_exe(fn):
- if hasattr(os, 'chmod'):
- oldmode = os.stat(fn).st_mode & 0xFFF # 0o7777
- newmode = (oldmode | 0x16D) & 0xFFF # 0o555, 0o7777
- os.chmod(fn, newmode)
- logger.info('Changed mode of %s to %s', fn, oct(newmode))
-
-def _find_file(filename, dirs):
- for dir in dirs:
- if os.path.exists(join(dir, filename)):
- return join(dir, filename)
- return filename
-
-def _install_req(py_executable, unzip=False, distribute=False,
- search_dirs=None, never_download=False):
-
- if search_dirs is None:
- search_dirs = file_search_dirs()
-
- if not distribute:
- setup_fn = 'setuptools-0.6c11-py%s.egg' % sys.version[:3]
- project_name = 'setuptools'
- bootstrap_script = EZ_SETUP_PY
- source = None
- else:
- setup_fn = None
- source = 'distribute-0.6.16.tar.gz'
- project_name = 'distribute'
- bootstrap_script = DISTRIBUTE_SETUP_PY
- try:
- # check if the global Python has distribute installed or plain
- # setuptools
- import pkg_resources
- if not hasattr(pkg_resources, '_distribute'):
- location = os.path.dirname(pkg_resources.__file__)
- logger.notify("A globally installed setuptools was found (in %s)" % location)
- logger.notify("Use the --no-site-packages option to use distribute in "
- "the virtualenv.")
- except ImportError:
- pass
-
- if setup_fn is not None:
- setup_fn = _find_file(setup_fn, search_dirs)
-
- if source is not None:
- source = _find_file(source, search_dirs)
-
- if is_jython and os._name == 'nt':
- # Jython's .bat sys.executable can't handle a command line
- # argument with newlines
- fd, ez_setup = tempfile.mkstemp('.py')
- os.write(fd, bootstrap_script)
- os.close(fd)
- cmd = [py_executable, ez_setup]
- else:
- cmd = [py_executable, '-c', bootstrap_script]
- if unzip:
- cmd.append('--always-unzip')
- env = {}
- remove_from_env = []
- if logger.stdout_level_matches(logger.DEBUG):
- cmd.append('-v')
-
- old_chdir = os.getcwd()
- if setup_fn is not None and os.path.exists(setup_fn):
- logger.info('Using existing %s egg: %s' % (project_name, setup_fn))
- cmd.append(setup_fn)
- if os.environ.get('PYTHONPATH'):
- env['PYTHONPATH'] = setup_fn + os.path.pathsep + os.environ['PYTHONPATH']
- else:
- env['PYTHONPATH'] = setup_fn
- else:
- # the source is found, let's chdir
- if source is not None and os.path.exists(source):
- logger.info('Using existing %s egg: %s' % (project_name, source))
- os.chdir(os.path.dirname(source))
- # in this case, we want to be sure that PYTHONPATH is unset (not
- # just empty, really unset), else CPython tries to import the
- # site.py that it's in virtualenv_support
- remove_from_env.append('PYTHONPATH')
- else:
- if never_download:
- logger.fatal("Can't find any local distributions of %s to install "
- "and --never-download is set. Either re-run virtualenv "
- "without the --never-download option, or place a %s "
- "distribution (%s) in one of these "
- "locations: %r" % (project_name, project_name,
- setup_fn or source,
- search_dirs))
- sys.exit(1)
-
- logger.info('No %s egg found; downloading' % project_name)
- cmd.extend(['--always-copy', '-U', project_name])
- logger.start_progress('Installing %s...' % project_name)
- logger.indent += 2
- cwd = None
- if project_name == 'distribute':
- env['DONT_PATCH_SETUPTOOLS'] = 'true'
-
- def _filter_ez_setup(line):
- return filter_ez_setup(line, project_name)
-
- if not os.access(os.getcwd(), os.W_OK):
- cwd = tempfile.mkdtemp()
- if source is not None and os.path.exists(source):
- # the current working dir is hostile, let's copy the
- # tarball to a temp dir
- target = os.path.join(cwd, os.path.split(source)[-1])
- shutil.copy(source, target)
- try:
- call_subprocess(cmd, show_stdout=False,
- filter_stdout=_filter_ez_setup,
- extra_env=env,
- remove_from_env=remove_from_env,
- cwd=cwd)
- finally:
- logger.indent -= 2
- logger.end_progress()
- if os.getcwd() != old_chdir:
- os.chdir(old_chdir)
- if is_jython and os._name == 'nt':
- os.remove(ez_setup)
-
-def file_search_dirs():
- here = os.path.dirname(os.path.abspath(__file__))
- dirs = ['.', here,
- join(here, 'virtualenv_support')]
- if os.path.splitext(os.path.dirname(__file__))[0] != 'virtualenv':
- # Probably some boot script; just in case virtualenv is installed...
- try:
- import virtualenv
- except ImportError:
- pass
- else:
- dirs.append(os.path.join(os.path.dirname(virtualenv.__file__), 'virtualenv_support'))
- return [d for d in dirs if os.path.isdir(d)]
-
-def install_setuptools(py_executable, unzip=False,
- search_dirs=None, never_download=False):
- _install_req(py_executable, unzip,
- search_dirs=search_dirs, never_download=never_download)
-
-def install_distribute(py_executable, unzip=False,
- search_dirs=None, never_download=False):
- _install_req(py_executable, unzip, distribute=True,
- search_dirs=search_dirs, never_download=never_download)
-
-_pip_re = re.compile(r'^pip-.*(zip|tar.gz|tar.bz2|tgz|tbz)$', re.I)
-def install_pip(py_executable, search_dirs=None, never_download=False):
- if search_dirs is None:
- search_dirs = file_search_dirs()
-
- filenames = []
- for dir in search_dirs:
- filenames.extend([join(dir, fn) for fn in os.listdir(dir)
- if _pip_re.search(fn)])
- filenames = [(os.path.basename(filename).lower(), i, filename) for i, filename in enumerate(filenames)]
- filenames.sort()
- filenames = [filename for basename, i, filename in filenames]
- if not filenames:
- filename = 'pip'
- else:
- filename = filenames[-1]
- easy_install_script = 'easy_install'
- if sys.platform == 'win32':
- easy_install_script = 'easy_install-script.py'
- cmd = [py_executable, join(os.path.dirname(py_executable), easy_install_script), filename]
- if filename == 'pip':
- if never_download:
- logger.fatal("Can't find any local distributions of pip to install "
- "and --never-download is set. Either re-run virtualenv "
- "without the --never-download option, or place a pip "
- "source distribution (zip/tar.gz/tar.bz2) in one of these "
- "locations: %r" % search_dirs)
- sys.exit(1)
- logger.info('Installing pip from network...')
- else:
- logger.info('Installing existing %s distribution: %s' % (
- os.path.basename(filename), filename))
- logger.start_progress('Installing pip...')
- logger.indent += 2
- def _filter_setup(line):
- return filter_ez_setup(line, 'pip')
- try:
- call_subprocess(cmd, show_stdout=False,
- filter_stdout=_filter_setup)
- finally:
- logger.indent -= 2
- logger.end_progress()
-
-def filter_ez_setup(line, project_name='setuptools'):
- if not line.strip():
- return Logger.DEBUG
- if project_name == 'distribute':
- for prefix in ('Extracting', 'Now working', 'Installing', 'Before',
- 'Scanning', 'Setuptools', 'Egg', 'Already',
- 'running', 'writing', 'reading', 'installing',
- 'creating', 'copying', 'byte-compiling', 'removing',
- 'Processing'):
- if line.startswith(prefix):
- return Logger.DEBUG
- return Logger.DEBUG
- for prefix in ['Reading ', 'Best match', 'Processing setuptools',
- 'Copying setuptools', 'Adding setuptools',
- 'Installing ', 'Installed ']:
- if line.startswith(prefix):
- return Logger.DEBUG
- return Logger.INFO
-
-def main():
- parser = optparse.OptionParser(
- version=virtualenv_version,
- usage="%prog [OPTIONS] DEST_DIR")
-
- parser.add_option(
- '-v', '--verbose',
- action='count',
- dest='verbose',
- default=0,
- help="Increase verbosity")
-
- parser.add_option(
- '-q', '--quiet',
- action='count',
- dest='quiet',
- default=0,
- help='Decrease verbosity')
-
- parser.add_option(
- '-p', '--python',
- dest='python',
- metavar='PYTHON_EXE',
- help='The Python interpreter to use, e.g., --python=python2.5 will use the python2.5 '
- 'interpreter to create the new environment. The default is the interpreter that '
- 'virtualenv was installed with (%s)' % sys.executable)
-
- parser.add_option(
- '--clear',
- dest='clear',
- action='store_true',
- help="Clear out the non-root install and start from scratch")
-
- parser.add_option(
- '--no-site-packages',
- dest='no_site_packages',
- action='store_true',
- help="Don't give access to the global site-packages dir to the "
- "virtual environment")
-
- parser.add_option(
- '--unzip-setuptools',
- dest='unzip_setuptools',
- action='store_true',
- help="Unzip Setuptools or Distribute when installing it")
-
- parser.add_option(
- '--relocatable',
- dest='relocatable',
- action='store_true',
- help='Make an EXISTING virtualenv environment relocatable. '
- 'This fixes up scripts and makes all .pth files relative')
-
- parser.add_option(
- '--distribute',
- dest='use_distribute',
- action='store_true',
- help='Use Distribute instead of Setuptools. Set environ variable '
- 'VIRTUALENV_USE_DISTRIBUTE to make it the default ')
-
- default_search_dirs = file_search_dirs()
- parser.add_option(
- '--extra-search-dir',
- dest="search_dirs",
- action="append",
- default=default_search_dirs,
- help="Directory to look for setuptools/distribute/pip distributions in. "
- "You can add any number of additional --extra-search-dir paths.")
-
- parser.add_option(
- '--never-download',
- dest="never_download",
- action="store_true",
- help="Never download anything from the network. Instead, virtualenv will fail "
- "if local distributions of setuptools/distribute/pip are not present.")
-
- parser.add_option(
- '--prompt=',
- dest='prompt',
- help='Provides an alternative prompt prefix for this environment')
-
- if 'extend_parser' in globals():
- extend_parser(parser)
-
- options, args = parser.parse_args()
-
- global logger
-
- if 'adjust_options' in globals():
- adjust_options(options, args)
-
- verbosity = options.verbose - options.quiet
- logger = Logger([(Logger.level_for_integer(2-verbosity), sys.stdout)])
-
- if options.python and not os.environ.get('VIRTUALENV_INTERPRETER_RUNNING'):
- env = os.environ.copy()
- interpreter = resolve_interpreter(options.python)
- if interpreter == sys.executable:
- logger.warn('Already using interpreter %s' % interpreter)
- else:
- logger.notify('Running virtualenv with interpreter %s' % interpreter)
- env['VIRTUALENV_INTERPRETER_RUNNING'] = 'true'
- file = __file__
- if file.endswith('.pyc'):
- file = file[:-1]
- popen = subprocess.Popen([interpreter, file] + sys.argv[1:], env=env)
- raise SystemExit(popen.wait())
-
- if not args:
- print('You must provide a DEST_DIR')
- parser.print_help()
- sys.exit(2)
- if len(args) > 1:
- print('There must be only one argument: DEST_DIR (you gave %s)' % (
- ' '.join(args)))
- parser.print_help()
- sys.exit(2)
-
- home_dir = args[0]
-
- if os.environ.get('WORKING_ENV'):
- logger.fatal('ERROR: you cannot run virtualenv while in a workingenv')
- logger.fatal('Please deactivate your workingenv, then re-run this script')
- sys.exit(3)
-
- if 'PYTHONHOME' in os.environ:
- logger.warn('PYTHONHOME is set. You *must* activate the virtualenv before using it')
- del os.environ['PYTHONHOME']
-
- if options.relocatable:
- make_environment_relocatable(home_dir)
- return
-
- create_environment(home_dir, site_packages=not options.no_site_packages, clear=options.clear,
- unzip_setuptools=options.unzip_setuptools,
- use_distribute=options.use_distribute or majver > 2,
- prompt=options.prompt,
- search_dirs=options.search_dirs,
- never_download=options.never_download)
- if 'after_install' in globals():
- after_install(options, home_dir)
-
-def call_subprocess(cmd, show_stdout=True,
- filter_stdout=None, cwd=None,
- raise_on_returncode=True, extra_env=None,
- remove_from_env=None):
- cmd_parts = []
- for part in cmd:
- if len(part) > 45:
- part = part[:20]+"..."+part[-20:]
- if ' ' in part or '\n' in part or '"' in part or "'" in part:
- part = '"%s"' % part.replace('"', '\\"')
- cmd_parts.append(part)
- cmd_desc = ' '.join(cmd_parts)
- if show_stdout:
- stdout = None
- else:
- stdout = subprocess.PIPE
- logger.debug("Running command %s" % cmd_desc)
- if extra_env or remove_from_env:
- env = os.environ.copy()
- if extra_env:
- env.update(extra_env)
- if remove_from_env:
- for varname in remove_from_env:
- env.pop(varname, None)
- else:
- env = None
- try:
- proc = subprocess.Popen(
- cmd, stderr=subprocess.STDOUT, stdin=None, stdout=stdout,
- cwd=cwd, env=env)
- except Exception:
- e = sys.exc_info()[1]
- logger.fatal(
- "Error %s while executing command %s" % (e, cmd_desc))
- raise
- all_output = []
- if stdout is not None:
- stdout = proc.stdout
- encoding = sys.getdefaultencoding()
- while 1:
- line = stdout.readline().decode(encoding)
- if not line:
- break
- line = line.rstrip()
- all_output.append(line)
- if filter_stdout:
- level = filter_stdout(line)
- if isinstance(level, tuple):
- level, line = level
- logger.log(level, line)
- if not logger.stdout_level_matches(level):
- logger.show_progress()
- else:
- logger.info(line)
- else:
- proc.communicate()
- proc.wait()
- if proc.returncode:
- if raise_on_returncode:
- if all_output:
- logger.notify('Complete output from command %s:' % cmd_desc)
- logger.notify('\n'.join(all_output) + '\n----------------------------------------')
- raise OSError(
- "Command %s failed with error code %s"
- % (cmd_desc, proc.returncode))
- else:
- logger.warn(
- "Command %s had error code %s"
- % (cmd_desc, proc.returncode))
-
-
-def create_environment(home_dir, site_packages=True, clear=False,
- unzip_setuptools=False, use_distribute=False,
- prompt=None, search_dirs=None, never_download=False):
- """
- Creates a new environment in ``home_dir``.
-
- If ``site_packages`` is true (the default) then the global
- ``site-packages/`` directory will be on the path.
-
- If ``clear`` is true (default False) then the environment will
- first be cleared.
- """
- home_dir, lib_dir, inc_dir, bin_dir = path_locations(home_dir)
-
- py_executable = os.path.abspath(install_python(
- home_dir, lib_dir, inc_dir, bin_dir,
- site_packages=site_packages, clear=clear))
-
- install_distutils(home_dir)
-
- if use_distribute or os.environ.get('VIRTUALENV_USE_DISTRIBUTE'):
- install_distribute(py_executable, unzip=unzip_setuptools,
- search_dirs=search_dirs, never_download=never_download)
- else:
- install_setuptools(py_executable, unzip=unzip_setuptools,
- search_dirs=search_dirs, never_download=never_download)
-
- install_pip(py_executable, search_dirs=search_dirs, never_download=never_download)
-
- install_activate(home_dir, bin_dir, prompt)
-
-def path_locations(home_dir):
- """Return the path locations for the environment (where libraries are,
- where scripts go, etc)"""
- # XXX: We'd use distutils.sysconfig.get_python_inc/lib but its
- # prefix arg is broken: http://bugs.python.org/issue3386
- if sys.platform == 'win32':
- # Windows has lots of problems with executables with spaces in
- # the name; this function will remove them (using the ~1
- # format):
- mkdir(home_dir)
- if ' ' in home_dir:
- try:
- import win32api
- except ImportError:
- print('Error: the path "%s" has a space in it' % home_dir)
- print('To handle these kinds of paths, the win32api module must be installed:')
- print(' http://sourceforge.net/projects/pywin32/')
- sys.exit(3)
- home_dir = win32api.GetShortPathName(home_dir)
- lib_dir = join(home_dir, 'Lib')
- inc_dir = join(home_dir, 'Include')
- bin_dir = join(home_dir, 'Scripts')
- elif is_jython:
- lib_dir = join(home_dir, 'Lib')
- inc_dir = join(home_dir, 'Include')
- bin_dir = join(home_dir, 'bin')
- elif is_pypy:
- lib_dir = home_dir
- inc_dir = join(home_dir, 'include')
- bin_dir = join(home_dir, 'bin')
- else:
- lib_dir = join(home_dir, 'lib', py_version)
- inc_dir = join(home_dir, 'include', py_version + abiflags)
- bin_dir = join(home_dir, 'bin')
- return home_dir, lib_dir, inc_dir, bin_dir
-
-
-def change_prefix(filename, dst_prefix):
- prefixes = [sys.prefix]
-
- if sys.platform == "darwin":
- prefixes.extend((
- os.path.join("/Library/Python", sys.version[:3], "site-packages"),
- os.path.join(sys.prefix, "Extras", "lib", "python"),
- os.path.join("~", "Library", "Python", sys.version[:3], "site-packages")))
-
- if hasattr(sys, 'real_prefix'):
- prefixes.append(sys.real_prefix)
- prefixes = list(map(os.path.abspath, prefixes))
- filename = os.path.abspath(filename)
- for src_prefix in prefixes:
- if filename.startswith(src_prefix):
- _, relpath = filename.split(src_prefix, 1)
- assert relpath[0] == os.sep
- relpath = relpath[1:]
- return join(dst_prefix, relpath)
- assert False, "Filename %s does not start with any of these prefixes: %s" % \
- (filename, prefixes)
-
-def copy_required_modules(dst_prefix):
- import imp
- for modname in REQUIRED_MODULES:
- if modname in sys.builtin_module_names:
- logger.info("Ignoring built-in bootstrap module: %s" % modname)
- continue
- try:
- f, filename, _ = imp.find_module(modname)
- except ImportError:
- logger.info("Cannot import bootstrap module: %s" % modname)
- else:
- if f is not None:
- f.close()
- dst_filename = change_prefix(filename, dst_prefix)
- copyfile(filename, dst_filename)
- if filename.endswith('.pyc'):
- pyfile = filename[:-1]
- if os.path.exists(pyfile):
- copyfile(pyfile, dst_filename[:-1])
-
-
-def install_python(home_dir, lib_dir, inc_dir, bin_dir, site_packages, clear):
- """Install just the base environment, no distutils patches etc"""
- if sys.executable.startswith(bin_dir):
- print('Please use the *system* python to run this script')
- return
-
- if clear:
- rmtree(lib_dir)
- ## FIXME: why not delete it?
- ## Maybe it should delete everything with #!/path/to/venv/python in it
- logger.notify('Not deleting %s', bin_dir)
-
- if hasattr(sys, 'real_prefix'):
- logger.notify('Using real prefix %r' % sys.real_prefix)
- prefix = sys.real_prefix
- else:
- prefix = sys.prefix
- mkdir(lib_dir)
- fix_lib64(lib_dir)
- stdlib_dirs = [os.path.dirname(os.__file__)]
- if sys.platform == 'win32':
- stdlib_dirs.append(join(os.path.dirname(stdlib_dirs[0]), 'DLLs'))
- elif sys.platform == 'darwin':
- stdlib_dirs.append(join(stdlib_dirs[0], 'site-packages'))
- if hasattr(os, 'symlink'):
- logger.info('Symlinking Python bootstrap modules')
- else:
- logger.info('Copying Python bootstrap modules')
- logger.indent += 2
- try:
- # copy required files...
- for stdlib_dir in stdlib_dirs:
- if not os.path.isdir(stdlib_dir):
- continue
- for fn in os.listdir(stdlib_dir):
- bn = os.path.splitext(fn)[0]
- if fn != 'site-packages' and bn in REQUIRED_FILES:
- copyfile(join(stdlib_dir, fn), join(lib_dir, fn))
- # ...and modules
- copy_required_modules(home_dir)
- finally:
- logger.indent -= 2
- mkdir(join(lib_dir, 'site-packages'))
- import site
- site_filename = site.__file__
- if site_filename.endswith('.pyc'):
- site_filename = site_filename[:-1]
- elif site_filename.endswith('$py.class'):
- site_filename = site_filename.replace('$py.class', '.py')
- site_filename_dst = change_prefix(site_filename, home_dir)
- site_dir = os.path.dirname(site_filename_dst)
- writefile(site_filename_dst, SITE_PY)
- writefile(join(site_dir, 'orig-prefix.txt'), prefix)
- site_packages_filename = join(site_dir, 'no-global-site-packages.txt')
- if not site_packages:
- writefile(site_packages_filename, '')
- else:
- if os.path.exists(site_packages_filename):
- logger.info('Deleting %s' % site_packages_filename)
- os.unlink(site_packages_filename)
-
- if is_pypy:
- stdinc_dir = join(prefix, 'include')
- else:
- stdinc_dir = join(prefix, 'include', py_version + abiflags)
- if os.path.exists(stdinc_dir):
- copyfile(stdinc_dir, inc_dir)
- else:
- logger.debug('No include dir %s' % stdinc_dir)
-
- # pypy never uses exec_prefix, just ignore it
- if sys.exec_prefix != prefix and not is_pypy:
- if sys.platform == 'win32':
- exec_dir = join(sys.exec_prefix, 'lib')
- elif is_jython:
- exec_dir = join(sys.exec_prefix, 'Lib')
- else:
- exec_dir = join(sys.exec_prefix, 'lib', py_version)
- for fn in os.listdir(exec_dir):
- copyfile(join(exec_dir, fn), join(lib_dir, fn))
-
- if is_jython:
- # Jython has either jython-dev.jar and javalib/ dir, or just
- # jython.jar
- for name in 'jython-dev.jar', 'javalib', 'jython.jar':
- src = join(prefix, name)
- if os.path.exists(src):
- copyfile(src, join(home_dir, name))
- # XXX: registry should always exist after Jython 2.5rc1
- src = join(prefix, 'registry')
- if os.path.exists(src):
- copyfile(src, join(home_dir, 'registry'), symlink=False)
- copyfile(join(prefix, 'cachedir'), join(home_dir, 'cachedir'),
- symlink=False)
-
- mkdir(bin_dir)
- py_executable = join(bin_dir, os.path.basename(sys.executable))
- if 'Python.framework' in prefix:
- if re.search(r'/Python(?:-32|-64)*$', py_executable):
- # The name of the python executable is not quite what
- # we want, rename it.
- py_executable = os.path.join(
- os.path.dirname(py_executable), 'python')
-
- logger.notify('New %s executable in %s', expected_exe, py_executable)
- if sys.executable != py_executable:
- ## FIXME: could I just hard link?
- executable = sys.executable
- if sys.platform == 'cygwin' and os.path.exists(executable + '.exe'):
- # Cygwin misreports sys.executable sometimes
- executable += '.exe'
- py_executable += '.exe'
- logger.info('Executable actually exists in %s' % executable)
- shutil.copyfile(executable, py_executable)
- make_exe(py_executable)
- if sys.platform == 'win32' or sys.platform == 'cygwin':
- pythonw = os.path.join(os.path.dirname(sys.executable), 'pythonw.exe')
- if os.path.exists(pythonw):
- logger.info('Also created pythonw.exe')
- shutil.copyfile(pythonw, os.path.join(os.path.dirname(py_executable), 'pythonw.exe'))
- if is_pypy:
- # make a symlink python --> pypy-c
- python_executable = os.path.join(os.path.dirname(py_executable), 'python')
- logger.info('Also created executable %s' % python_executable)
- copyfile(py_executable, python_executable)
-
- if os.path.splitext(os.path.basename(py_executable))[0] != expected_exe:
- secondary_exe = os.path.join(os.path.dirname(py_executable),
- expected_exe)
- py_executable_ext = os.path.splitext(py_executable)[1]
- if py_executable_ext == '.exe':
- # python2.4 gives an extension of '.4' :P
- secondary_exe += py_executable_ext
- if os.path.exists(secondary_exe):
- logger.warn('Not overwriting existing %s script %s (you must use %s)'
- % (expected_exe, secondary_exe, py_executable))
- else:
- logger.notify('Also creating executable in %s' % secondary_exe)
- shutil.copyfile(sys.executable, secondary_exe)
- make_exe(secondary_exe)
-
- if 'Python.framework' in prefix:
- logger.debug('MacOSX Python framework detected')
-
- # Make sure we use the the embedded interpreter inside
- # the framework, even if sys.executable points to
- # the stub executable in ${sys.prefix}/bin
- # See http://groups.google.com/group/python-virtualenv/
- # browse_thread/thread/17cab2f85da75951
- original_python = os.path.join(
- prefix, 'Resources/Python.app/Contents/MacOS/Python')
- shutil.copy(original_python, py_executable)
-
- # Copy the framework's dylib into the virtual
- # environment
- virtual_lib = os.path.join(home_dir, '.Python')
-
- if os.path.exists(virtual_lib):
- os.unlink(virtual_lib)
- copyfile(
- os.path.join(prefix, 'Python'),
- virtual_lib)
-
- # And then change the install_name of the copied python executable
- try:
- call_subprocess(
- ["install_name_tool", "-change",
- os.path.join(prefix, 'Python'),
- '@executable_path/../.Python',
- py_executable])
- except:
- logger.fatal(
- "Could not call install_name_tool -- you must have Apple's development tools installed")
- raise
-
- # Some tools depend on pythonX.Y being present
- py_executable_version = '%s.%s' % (
- sys.version_info[0], sys.version_info[1])
- if not py_executable.endswith(py_executable_version):
- # symlinking pythonX.Y > python
- pth = py_executable + '%s.%s' % (
- sys.version_info[0], sys.version_info[1])
- if os.path.exists(pth):
- os.unlink(pth)
- os.symlink('python', pth)
- else:
- # reverse symlinking python -> pythonX.Y (with --python)
- pth = join(bin_dir, 'python')
- if os.path.exists(pth):
- os.unlink(pth)
- os.symlink(os.path.basename(py_executable), pth)
-
- if sys.platform == 'win32' and ' ' in py_executable:
- # There's a bug with subprocess on Windows when using a first
- # argument that has a space in it. Instead we have to quote
- # the value:
- py_executable = '"%s"' % py_executable
- cmd = [py_executable, '-c', 'import sys; print(sys.prefix)']
- logger.info('Testing executable with %s %s "%s"' % tuple(cmd))
- try:
- proc = subprocess.Popen(cmd,
- stdout=subprocess.PIPE)
- proc_stdout, proc_stderr = proc.communicate()
- except OSError:
- e = sys.exc_info()[1]
- if e.errno == errno.EACCES:
- logger.fatal('ERROR: The executable %s could not be run: %s' % (py_executable, e))
- sys.exit(100)
- else:
- raise e
-
- proc_stdout = proc_stdout.strip().decode(sys.getdefaultencoding())
- proc_stdout = os.path.normcase(os.path.abspath(proc_stdout))
- if proc_stdout != os.path.normcase(os.path.abspath(home_dir)):
- logger.fatal(
- 'ERROR: The executable %s is not functioning' % py_executable)
- logger.fatal(
- 'ERROR: It thinks sys.prefix is %r (should be %r)'
- % (proc_stdout, os.path.normcase(os.path.abspath(home_dir))))
- logger.fatal(
- 'ERROR: virtualenv is not compatible with this system or executable')
- if sys.platform == 'win32':
- logger.fatal(
- 'Note: some Windows users have reported this error when they installed Python for "Only this user". The problem may be resolvable if you install Python "For all users". (See https://bugs.launchpad.net/virtualenv/+bug/352844)')
- sys.exit(100)
- else:
- logger.info('Got sys.prefix result: %r' % proc_stdout)
-
- pydistutils = os.path.expanduser('~/.pydistutils.cfg')
- if os.path.exists(pydistutils):
- logger.notify('Please make sure you remove any previous custom paths from '
- 'your %s file.' % pydistutils)
- ## FIXME: really this should be calculated earlier
- return py_executable
-
-def install_activate(home_dir, bin_dir, prompt=None):
- if sys.platform == 'win32' or is_jython and os._name == 'nt':
- files = {'activate.bat': ACTIVATE_BAT,
- 'deactivate.bat': DEACTIVATE_BAT}
- if os.environ.get('OS') == 'Windows_NT' and os.environ.get('OSTYPE') == 'cygwin':
- files['activate'] = ACTIVATE_SH
- else:
- files = {'activate': ACTIVATE_SH}
-
- # suppling activate.fish in addition to, not instead of, the
- # bash script support.
- files['activate.fish'] = ACTIVATE_FISH
-
- # same for csh/tcsh support...
- files['activate.csh'] = ACTIVATE_CSH
-
-
-
- files['activate_this.py'] = ACTIVATE_THIS
- vname = os.path.basename(os.path.abspath(home_dir))
- for name, content in files.items():
- content = content.replace('__VIRTUAL_PROMPT__', prompt or '')
- content = content.replace('__VIRTUAL_WINPROMPT__', prompt or '(%s)' % vname)
- content = content.replace('__VIRTUAL_ENV__', os.path.abspath(home_dir))
- content = content.replace('__VIRTUAL_NAME__', vname)
- content = content.replace('__BIN_NAME__', os.path.basename(bin_dir))
- writefile(os.path.join(bin_dir, name), content)
-
-def install_distutils(home_dir):
- distutils_path = change_prefix(distutils.__path__[0], home_dir)
- mkdir(distutils_path)
- ## FIXME: maybe this prefix setting should only be put in place if
- ## there's a local distutils.cfg with a prefix setting?
- home_dir = os.path.abspath(home_dir)
- ## FIXME: this is breaking things, removing for now:
- #distutils_cfg = DISTUTILS_CFG + "\n[install]\nprefix=%s\n" % home_dir
- writefile(os.path.join(distutils_path, '__init__.py'), DISTUTILS_INIT)
- writefile(os.path.join(distutils_path, 'distutils.cfg'), DISTUTILS_CFG, overwrite=False)
-
-def fix_lib64(lib_dir):
- """
- Some platforms (particularly Gentoo on x64) put things in lib64/pythonX.Y
- instead of lib/pythonX.Y. If this is such a platform we'll just create a
- symlink so lib64 points to lib
- """
- if [p for p in distutils.sysconfig.get_config_vars().values()
- if isinstance(p, basestring) and 'lib64' in p]:
- logger.debug('This system uses lib64; symlinking lib64 to lib')
- assert os.path.basename(lib_dir) == 'python%s' % sys.version[:3], (
- "Unexpected python lib dir: %r" % lib_dir)
- lib_parent = os.path.dirname(lib_dir)
- assert os.path.basename(lib_parent) == 'lib', (
- "Unexpected parent dir: %r" % lib_parent)
- copyfile(lib_parent, os.path.join(os.path.dirname(lib_parent), 'lib64'))
-
-def resolve_interpreter(exe):
- """
- If the executable given isn't an absolute path, search $PATH for the interpreter
- """
- if os.path.abspath(exe) != exe:
- paths = os.environ.get('PATH', '').split(os.pathsep)
- for path in paths:
- if os.path.exists(os.path.join(path, exe)):
- exe = os.path.join(path, exe)
- break
- if not os.path.exists(exe):
- logger.fatal('The executable %s (from --python=%s) does not exist' % (exe, exe))
- raise SystemExit(3)
- if not is_executable(exe):
- logger.fatal('The executable %s (from --python=%s) is not executable' % (exe, exe))
- raise SystemExit(3)
- return exe
-
-def is_executable(exe):
- """Checks a file is executable"""
- return os.access(exe, os.X_OK)
-
-############################################################
-## Relocating the environment:
-
-def make_environment_relocatable(home_dir):
- """
- Makes the already-existing environment use relative paths, and takes out
- the #!-based environment selection in scripts.
- """
- home_dir, lib_dir, inc_dir, bin_dir = path_locations(home_dir)
- activate_this = os.path.join(bin_dir, 'activate_this.py')
- if not os.path.exists(activate_this):
- logger.fatal(
- 'The environment doesn\'t have a file %s -- please re-run virtualenv '
- 'on this environment to update it' % activate_this)
- fixup_scripts(home_dir)
- fixup_pth_and_egg_link(home_dir)
- ## FIXME: need to fix up distutils.cfg
-
-OK_ABS_SCRIPTS = ['python', 'python%s' % sys.version[:3],
- 'activate', 'activate.bat', 'activate_this.py']
-
-def fixup_scripts(home_dir):
- # This is what we expect at the top of scripts:
- shebang = '#!%s/bin/python' % os.path.normcase(os.path.abspath(home_dir))
- # This is what we'll put:
- new_shebang = '#!/usr/bin/env python%s' % sys.version[:3]
- activate = "import os; activate_this=os.path.join(os.path.dirname(__file__), 'activate_this.py'); execfile(activate_this, dict(__file__=activate_this)); del os, activate_this"
- if sys.platform == 'win32':
- bin_suffix = 'Scripts'
- else:
- bin_suffix = 'bin'
- bin_dir = os.path.join(home_dir, bin_suffix)
- home_dir, lib_dir, inc_dir, bin_dir = path_locations(home_dir)
- for filename in os.listdir(bin_dir):
- filename = os.path.join(bin_dir, filename)
- if not os.path.isfile(filename):
- # ignore subdirs, e.g. .svn ones.
- continue
- f = open(filename, 'rb')
- lines = f.readlines()
- f.close()
- if not lines:
- logger.warn('Script %s is an empty file' % filename)
- continue
- if not lines[0].strip().startswith(shebang):
- if os.path.basename(filename) in OK_ABS_SCRIPTS:
- logger.debug('Cannot make script %s relative' % filename)
- elif lines[0].strip() == new_shebang:
- logger.info('Script %s has already been made relative' % filename)
- else:
- logger.warn('Script %s cannot be made relative (it\'s not a normal script that starts with %s)'
- % (filename, shebang))
- continue
- logger.notify('Making script %s relative' % filename)
- lines = [new_shebang+'\n', activate+'\n'] + lines[1:]
- f = open(filename, 'wb')
- f.writelines(lines)
- f.close()
-
-def fixup_pth_and_egg_link(home_dir, sys_path=None):
- """Makes .pth and .egg-link files use relative paths"""
- home_dir = os.path.normcase(os.path.abspath(home_dir))
- if sys_path is None:
- sys_path = sys.path
- for path in sys_path:
- if not path:
- path = '.'
- if not os.path.isdir(path):
- continue
- path = os.path.normcase(os.path.abspath(path))
- if not path.startswith(home_dir):
- logger.debug('Skipping system (non-environment) directory %s' % path)
- continue
- for filename in os.listdir(path):
- filename = os.path.join(path, filename)
- if filename.endswith('.pth'):
- if not os.access(filename, os.W_OK):
- logger.warn('Cannot write .pth file %s, skipping' % filename)
- else:
- fixup_pth_file(filename)
- if filename.endswith('.egg-link'):
- if not os.access(filename, os.W_OK):
- logger.warn('Cannot write .egg-link file %s, skipping' % filename)
- else:
- fixup_egg_link(filename)
-
-def fixup_pth_file(filename):
- lines = []
- prev_lines = []
- f = open(filename)
- prev_lines = f.readlines()
- f.close()
- for line in prev_lines:
- line = line.strip()
- if (not line or line.startswith('#') or line.startswith('import ')
- or os.path.abspath(line) != line):
- lines.append(line)
- else:
- new_value = make_relative_path(filename, line)
- if line != new_value:
- logger.debug('Rewriting path %s as %s (in %s)' % (line, new_value, filename))
- lines.append(new_value)
- if lines == prev_lines:
- logger.info('No changes to .pth file %s' % filename)
- return
- logger.notify('Making paths in .pth file %s relative' % filename)
- f = open(filename, 'w')
- f.write('\n'.join(lines) + '\n')
- f.close()
-
-def fixup_egg_link(filename):
- f = open(filename)
- link = f.read().strip()
- f.close()
- if os.path.abspath(link) != link:
- logger.debug('Link in %s already relative' % filename)
- return
- new_link = make_relative_path(filename, link)
- logger.notify('Rewriting link %s in %s as %s' % (link, filename, new_link))
- f = open(filename, 'w')
- f.write(new_link)
- f.close()
-
-def make_relative_path(source, dest, dest_is_directory=True):
- """
- Make a filename relative, where the filename is dest, and it is
- being referred to from the filename source.
-
- >>> make_relative_path('/usr/share/something/a-file.pth',
- ... '/usr/share/another-place/src/Directory')
- '../another-place/src/Directory'
- >>> make_relative_path('/usr/share/something/a-file.pth',
- ... '/home/user/src/Directory')
- '../../../home/user/src/Directory'
- >>> make_relative_path('/usr/share/a-file.pth', '/usr/share/')
- './'
- """
- source = os.path.dirname(source)
- if not dest_is_directory:
- dest_filename = os.path.basename(dest)
- dest = os.path.dirname(dest)
- dest = os.path.normpath(os.path.abspath(dest))
- source = os.path.normpath(os.path.abspath(source))
- dest_parts = dest.strip(os.path.sep).split(os.path.sep)
- source_parts = source.strip(os.path.sep).split(os.path.sep)
- while dest_parts and source_parts and dest_parts[0] == source_parts[0]:
- dest_parts.pop(0)
- source_parts.pop(0)
- full_parts = ['..']*len(source_parts) + dest_parts
- if not dest_is_directory:
- full_parts.append(dest_filename)
- if not full_parts:
- # Special case for the current directory (otherwise it'd be '')
- return './'
- return os.path.sep.join(full_parts)
-
-
-
-############################################################
-## Bootstrap script creation:
-
-def create_bootstrap_script(extra_text, python_version=''):
- """
- Creates a bootstrap script, which is like this script but with
- extend_parser, adjust_options, and after_install hooks.
-
- This returns a string that (written to disk of course) can be used
- as a bootstrap script with your own customizations. The script
- will be the standard virtualenv.py script, with your extra text
- added (your extra text should be Python code).
-
- If you include these functions, they will be called:
-
- ``extend_parser(optparse_parser)``:
- You can add or remove options from the parser here.
-
- ``adjust_options(options, args)``:
- You can change options here, or change the args (if you accept
- different kinds of arguments, be sure you modify ``args`` so it is
- only ``[DEST_DIR]``).
-
- ``after_install(options, home_dir)``:
-
- After everything is installed, this function is called. This
- is probably the function you are most likely to use. An
- example would be::
-
- def after_install(options, home_dir):
- subprocess.call([join(home_dir, 'bin', 'easy_install'),
- 'MyPackage'])
- subprocess.call([join(home_dir, 'bin', 'my-package-script'),
- 'setup', home_dir])
-
- This example immediately installs a package, and runs a setup
- script from that package.
-
- If you provide something like ``python_version='2.4'`` then the
- script will start with ``#!/usr/bin/env python2.4`` instead of
- ``#!/usr/bin/env python``. You can use this when the script must
- be run with a particular Python version.
- """
- filename = __file__
- if filename.endswith('.pyc'):
- filename = filename[:-1]
- f = open(filename, 'rb')
- content = f.read()
- f.close()
- py_exe = 'python%s' % python_version
- content = (('#!/usr/bin/env %s\n' % py_exe)
- + '## WARNING: This file is generated\n'
- + content)
- return content.replace('##EXT' 'END##', extra_text)
-
-##EXTEND##
-
-def convert(s):
- b = base64.b64decode(s.encode('ascii'))
- return zlib.decompress(b).decode('utf-8')
-
-##file site.py
-SITE_PY = convert("""
-eJzVPP1z2zaWv/OvwMqTIZXKdD66nR2n7o2TOK3v3MTbpLO5dT06SoIk1hTJEqQV7c3d337vAwAB
-kvLHdvvDaTKxRAIPDw/vGw8YjUanZSnzhdgUiyaTQsmkmq9FmdRrJZZFJep1Wi0Oy6Sqd/B0fpOs
-pBJ1IdROxdgqDoKnv/MTPBWf1qkyKMC3pKmLTVKn8yTLdiLdlEVVy4VYNFWar0Sap3WaZOk/oEWR
-x+Lp78cgOM8FzDxLZSVuZaUArhLFUlzu6nWRi6gpcc7P4z8nL8cToeZVWtbQoNI4A0XWSR3kUi4A
-TWjZKCBlWstDVcp5ukzntuG2aLKFKLNkLsV//RdPjZqGYaCKjdyuZSVFDsgATAmwSsQDvqaVmBcL
-GQvxWs4THICft8QKGNoE10whGfNCZEW+gjnlci6VSqqdiGZNTYAIZbEoAKcUMKjTLAu2RXWjxrCk
-tB5beCQSZg9/MsweME8cv885gOOHPPg5T79MGDZwD4Kr18w2lVymX0SCYOGn/CLnU/0sSpdikS6X
-QIO8HmOTgBFQIktnRyUtx7d6hb47IqwsVyYwhkSUuTG/pB5xcF6LJFPAtk2JNFKE+Vs5S5McqJHf
-wnAAEUgaDI2zSFVtx6HZiQIAVLiONUjJRolok6Q5MOuPyZzQ/luaL4qtGhMFYLWU+LVRtTv/aIAA
-0NohwCTAxTKr2eRZeiOz3RgQ+ATYV1I1WY0CsUgrOa+LKpWKAABqOyG/ANITkVRSk5A508jthOhP
-NElzXFgUMBR4fIkkWaarpiIJE8sUOBe44t2Hn8Tbs9fnp+81jxlgLLOrDeAMUGihHZxgAHHUqOoo
-K0Cg4+AC/4hksUAhW+H4gFfb4OjelQ4imHsZd/s4Cw5k14urh4E51qBMaKyA+v03dJmoNdDnf+5Z
-7yA43UcVmjh/264LkMk82UixTpi/kDOCbzWc7+KyXr8CblAIpwZSKVwcRDBFeEASl2ZRkUtRAotl
-aS7HAVBoRm39VQRWeF/kh7TWHU4ACFWQw0vn2ZhGzCVMtA/rFeoL03hHM9NNArvOm6IixQH8n89J
-F2VJfkM4KmIo/jaTqzTPESHkhSA8CGlgdZMCJy5icUGtSC+YRiJk7cUtUSQa4CVkOuBJ+SXZlJmc
-sPiibr1bjdBgshZmrTPmOGhZk3qlVWunOsh7L+LPHa4jNOt1JQF4M/OEblkUEzEDnU3YlMmGxave
-FsQ5wYA8USfkCWoJffE7UPRUqWYj7UvkFdAsxFDBssiyYgskOw4CIQ6wkTHKPnPCW3gH/wNc/D+T
-9XwdBM5IFrAGhcjvA4VAwCTIXHO1RsLjNs3KXSWT5qwpimohKxrqYcQ+YsQf2BjnGrwvam3UeLq4
-ysUmrVElzbTJTNni5WHN+vEVzxumAZZbEc1M05ZOG5xeVq6TmTQuyUwuURL0Ir2yyw5jBgNjki2u
-xYatDLwDssiULciwYkGls6wlOQEAg4UvydOyyaiRQgYTCQy0KQn+JkGTXmhnCdibzXKAConN9xzs
-D+D2DxCj7ToF+swBAmgY1FKwfLO0rtBBaPVR4Bt905/HB049X2rbxEMukzTTVj7Jg3N6eFZVJL5z
-WWKviSaGghnmNbp2qxzoiGI+Go2CwLhDO2W+Fiqoq90xsIIw40ynsyZFwzedoqnXP1TAowhnYK+b
-bWfhgYYwnd4DlZwuy6rY4Gs7t4+gTGAs7BEciEvSMpIdZI8TXyH5XJVemqZoux12FqiHgsufzt6d
-fz77KE7EVavSJl19dg1jnuUJsDVZBGCqzrCtLoOWqPhS1H3iHZh3YgqwZ9SbxFcmdQO8C6h/qhp6
-DdOYey+Ds/enry/Opj9/PPtp+vH80xkgCHZGBgc0ZTSPDTiMKgbhAK5cqFjb16DXgx68Pv1oHwTT
-VE3LXbmDB2AogYWrCOY7ESE+nGobPE3zZRGOqfGv7ISfsFrRHtfV8dfX4uREhL8mt0kYgNfTNuVF
-/JEE4NOulNC1hj9RocZBsJBLEJYbiSIVPSVPdswdgIjQstCW9dcizc175iN3CJL4iHoADtPpPEuU
-wsbTaQikpQ4DH+gQszuMchJBx3Lndh1rVPBTSViKHLtM8L8BFJMZ9UM0GEW3i2kEAraZJ0pyK5o+
-9JtOUctMp5EeEMSPeBxcJFYcoTBNUMtUKXiixCuodWaqyPAnwke5JZHBYAj1Gi6SDnbi2yRrpIqc
-SQERo6hDRlSNqSIOAqciAtvZLt143KWm4RloBuTLCtB7VYdy+DkADwUUjAm7MDTjaIlphpj+O8cG
-hAM4iSEqaKU6UFificuzS/Hy2YtDdEAgSlxY6njN0aameSPtwyWs1krWDsLcK5yQMIxduixRM+LT
-47thbmK7Mn1WWOolruSmuJULwBYZ2Fll8RO9gVga5jFPYBVBE5MFZ6VnPL0EI0eePUgLWnug3oag
-mPU3S3/A4bvMFagODoWJ1DpOZ+NVVsVtiu7BbKdfgnUD9YY2zrgigbNwHpOhEQMNAX5rjpTayhAU
-WNWwi0l4I0jU8ItWFcYE7gJ16zV9vcmLbT7l2PUE1WQ0tqyLgqWZFxu0S3Ag3oHdACQLCMVaojEU
-cNIFytYhIA/Th+kCZSkaAEBgmhUFWA4sE5zRFDnOw2ERxviVIOGtJFr4WzMEBUeGGA4kehvbB0ZL
-ICSYnFVwVjVoJkNZM81gYIckPtddxBw0+gA6VIzB0EUaGjcy9Ls6BuUsLlyl5PRDG/r582dmG7Wm
-jAgiNsNJo9FfknmLyx2YwhR0gvGhOL9CbLAFdxTANEqzpjj8KIqS/SdYz0st22C5IR6r6/L46Gi7
-3cY6H1BUqyO1PPrzX7755i/PWCcuFsQ/MB1HWnRyLD6id+iDxt8aC/SdWbkOP6a5z40EK5LkR5Hz
-iPh936SLQhwfjq3+RC5uDSv+b5wPUCBTMyhTGWg7ajF6og6fxC/VSDwRkds2GrMnoU2qtWK+1YUe
-dQG2GzyNedHkdegoUiW+AusGMfVCzppVaAf3bKT5AVNFOY0sDxw+v0YMfM4wfGVM8RS1BLEFWnyH
-9D8x2yTkz2gNgeRFE9WLd3fDWswQd/FwebfeoSM0ZoapQu5AifCbPFgAbeO+5OBHO6No9xxn1Hw8
-Q2AsfWCYV7uCEQoO4YJrMXGlzuFq9FFBmrasmkHBuKoRFDS4dTOmtgZHNjJEkOjdmPCcF1a3ADp1
-cn0mojerAC3ccXrWrssKjieEPHAintMTCU7tce/dM17aJssoBdPhUY8qDNhbaLTTBfBlZABMxKj6
-ecQtTWDxobMovAYDwArO2iCDLXvMhG9cH3B0MBpgp57V39ebaTwEAhcp4uzRg6ATyic8QqVAmsrI
-77mPxS1x+4PdaXGIqcwykUirPcLVVR6DQnWnYVqmOepeZ5HieVaAV2y1IjFS+953FihywcdDxkxL
-oCZDSw6n0Ql5e54AhrodJrxWDaYG3MwJYrRJFVk3JNMa/gO3gjISlD4CWhI0C+ahUuZP7F8gc3a+
-+sse9rCERoZwm+5zQ3oWQ8Mx7w8EklHnT0AKciBhXxjJdWR1kAGHOQvkCTe8lnulm2DECuTMsSCk
-ZgB3eukFOPgkxj0LklCE/KVWshRfiREsX1dUH6a7/6VcatIGkdOAXAWdbzhxcxFOHuKkk5fwGdrP
-SNDuRlkAB8/A5XFT8y6bG6a1aRJw1n3FbZECjUyZk9HYRfXaEMZN//7pxGnREssMYhjKG8jbhDEj
-jQO73Bo0LLgB4615dyz92M1YYN8oLNQLufkC8V9YpWpeqBAD3F7uwv1orujTxmJ7kc5G8MdbgNH4
-2oMkM52/wCzLPzFI6EEPh6B7k8W0yCKptmkekgLT9Dvxl6aHhyWlZ+SOPlI4dQQTxRzl0bsKBIQ2
-K49AnFATQFQuQ6Xd/j7YO6c4snC5+8hzm6+OX173iTvZl+Gxn+GlOvtSV4nC1cp40VgocLX6BhyV
-LkwuyXd6u1FvR2OYUBUKokjx4eNngYTgTOw22T1u6i3DIzb3zsn7GNRBr91Lrs7siF0AEdSKyChH
-4eM58uHIPnZyd0zsEUAexTB3LIqBpPnkn4Fz10LBGIeLXY55tK7KwA+8/ubr6UBm1EXym69H94zS
-IcaQ2EcdT9COTGUAYnDapkslk4x8DacTZRXzlndsm3LMCp3iP81k1wNOJ37Me2MyWvi95r3A0XwO
-iB4QZhezXyFYVTq/dZukGSXlAY3DQ9RzJs7m1MEwPh6ku1HGnBR4LM8mg6GQunoGCxNyYD/uT0f7
-Racm9zsQkJpPmag+Kgd6A77dP/I21d29w/2yP2ip/yCd9UhA3mxGAwR84BzM3ub//5mwsmJoWlmN
-O1pfybv1vAH2AHW4x825ww3pD827WUvjTLDcKfEUBfSp2NKGNuXycGcCoCzYzxiAg8uot0XfNFXF
-m5sk56WsDnHDbiKwlsd4GlQi1Adz9F7WiIltNqfcqFP5UQypzlBnO+1MwtZPHRbZdWFyJDK/TSvo
-C1olCn/48ONZ2GcAPQx2GgbnrqPhkofbKYT7CKYNNXHCx/RhCj2myz8vVV1X2Seo2TM2GUhNtj5h
-e4lHE7cOr8E9GQhvg5A3YjEinK/l/GYqaXMZ2RS7OknYN/gaMbF7zn6FkEqWVOYEM5lnDdKKHT2s
-T1s2+Zzy8bUEe66LSbG4hLaMOd20zJKViKjzAlMdmhspG3KbVNrbKasCyxdFky6OVulCyN+aJMMw
-Ui6XgAtuluhXMQ9PGQ/xlne9uaxNyXlTpfUOSJCoQu810Qa503C244lGHpK8rcAExC3zY/ERp43v
-mXALQy4TjPoZdpwkxnnYwWwGInfRc3ifF1McdUpVoBNGqr8PTI+D7ggFABgBUJj/aKwzRf4bSa/c
-DS1ac5eoqCU9UrqRbUEeB0KJxhhZ82/66TOiy1t7sFztx3J1N5arLparQSxXPparu7F0RQIX1iZJ
-jCQMJUq6afTBigw3x8HDnCXzNbfD6kCsAgSIojQBnZEpLpL1Mim8n0RASG07G5z0sK2wSLnssCo4
-5apBIvfjpokOHk15s9OZ6jV0Z56K8dn2VZn4fY/imIqJZtSd5W2R1EnsycUqK2YgthbdSQtgIroF
-J5yby2+nM84mdizV6PI/P/3w4T02R1Ajs51O3XAR0bDgVKKnSbVSfWlqg40S2JFa+oUf1E0DPHhg
-JodHOeD/3lJFATKO2NKOeCFK8ACo7sc2c6tjwrDzXJfR6OfM5Ly5cSJGeT1qJ7WHSKeXl29PP52O
-KMU0+t+RKzCGtr50uPiYFrZB339zm1uKYx8Qap1LaY2fOyeP1i1H3G9jDdiO2/vsuvPgxUMM9mBY
-6s/yD6UULAkQKtbJxscQ6sHBz+8KE3r0MYzYKw9zd3LYWbHvHNlzXBRH9IfS3N0B/M01jDGmQADt
-QkUmMmiDqY7St+b1Doo6QB/o6/3uEKwbenUjGZ+idhIDDqBDWdtsv/vn7Quw0VOyfn32/fn7i/PX
-l6effnBcQHTlPnw8eiHOfvwsqB4BDRj7RAluxddY+QKGxT0KIxYF/GswvbFoak5KQq+3Fxd6Z2CD
-hyGwOhZtTgzPuWzGQuMcDWc97UNd74IYZTpAck6dUHkInUrBeGnDJx5UoSto6TDLDJ3VRode+jSR
-OXVE+6gxSB80dknBILikCV5RnXNtosKKd5z0SZwBpLSNtoUIGeWgetvTzn6LyeZ7iTnqDE/azlrR
-X4UuruF1rMoshUjuVWhlSXfDcoyWcfRDu6HKeA1pQKc7jKwb8qz3YoFW61XIc9P9xy2j/dYAhi2D
-vYV555LKEahGF4upRIiNeOcglF/gq116vQYKFgw3lmpcRMN0Kcw+geBarFMIIIAn12B9MU4ACJ2V
-8BPQx052QBZYDRC+2SwO/xpqgvitf/lloHldZYd/FyVEQYJLV8IBYrqN30LgE8tYnH14Nw4ZOSoF
-FX9tsIAcHBLK8jnSTvUyvGM7jZTMlrqewdcH+EL7CfS6072SZaW7D7vGIUrAExWR1/BEGfqFWF5k
-YU9wKuMOaKyNt5jhGTN329t8DsTHtcwyXRF9/vbiDHxHLNdHCeJ9njMYjvMluGWri734DFwHFG7o
-wusK2bhCF5Y29Rex12wwM4siR729OgC7TpT97PfqpTqrJFUu2hFOm2GZgvMYWRnWwiwrs3anDVLY
-bUMUR5lhlpheVlQw6fME8DI9TTgkglgJDwOYNDPvWqZ5bSrksnQOehRULijUCQgJEhdPvBHnFTkn
-eotKmYMy8LDcVelqXWMyHTrHVKSPzX88/Xxx/p4K11+8bL3uAeacUCQw4aKFEyxJw2wHfHHLzJCr
-ptMhntWvEAZqH/jTfcXVECc8QK8fJxbxT/cVn1Q6cSJBngEoqKbsigcGAE63IblpZYFxtXEwftyS
-sxYzHwzlIvFghC4scOfX50TbsmNKKO9jXj5il2JZahpGprNbAtX96DkuS9xWWUTDjeDtkGyZzwy6
-3vTe7Cu2cj89KcRDk4BRv7U/hqlG6jXV03GYbR+3UFirbewvuZMrddrNcxRlIGLkdh67TDashHVz
-5kCvbLcHTHyr0TWSOKjKR7/kI+1heJhYYvfiFNORjk2QEcBMhtSnQxrwodAigAKhatPIkdzJ+OkL
-b46ONbh/jlp3gW38ARShrv2kMwVFBZwIX35jx5FfEVqoR49F6HgqucwLW5eEn+0avcrn/hwHZYCS
-mCh2VZKvZMSwJgbmVz6x96RgSdt6pL5Kr4cMizgH5/TLHg7vy8XwxolBrcMIvXY3ctdVRz55sMHg
-0YM7CeaDr5It6P6yqSNeyWGRHz5ttR/q/RCx2g2a6s3eKMR0zG/hnvVpAQ9SQ8NCD++3gd0i/PDa
-GEfW2sfOKZrQvtAe7LyC0KxWtC3jHF8zvqj1AlqDe9Ka/JF9qgtT7O+Bc0lOTsgC5cFdkN7cRrpB
-J50w4uMxfLYwpfLr9vSGfreQtzIrwPWCqA6r63+11fXj2KZTBuuOfjd2l7vL3TBu9KbF7NiU/6Nn
-pkpYvziX9RGiM5jxuQuzFhlc6l90SJLkN+Qlv/nb+US8ef8T/P9afoC4Co/HTcTfAQ3xpqggvuTz
-nXTwHk8O1Bw4Fo3CM3QEjbYq+I4CdNsuPTrjtog+0uCfZbCaUmAVZ7XhizEARZ4gnXlu/QRTqA+/
-zUmijjdqPMWhRRnpl0iD/Ycr8EDCkW4Zr+tNhvbCyZK0q3k1ujh/c/b+41lcf0EONz9HThbFLwDC
-6eg94gr3wybCPpk3+OTacZx/kFk54DfroNMc1MCgU4QQl5Q20ORLFxIbXCQVZg5EuVsU8xhbAsvz
-2bB6C4702Ikv7zX0npVFWNFY76K13jw+BmqIX7qKaAQNqY+eE/UkhJIZHlLix/Fo2BRPBKW24c/T
-m+3CzYzr0yY0wS6m7awjv7vVhWums4ZnOYnwOrHLYA4gZmmiNrO5ezDtQy70nRmg5WifQy6TJquF
-zEFyKcinywtA07tnyVhCmFXYnNEBK0rTZNtkp5xKm0SJEY46ovPXuCFDGUOIwX9Mbtge4CE30fBp
-WYBOiFL8VDhdVTNfswRzSETUGyg82Kb5yxdhj8I8KEfI89aRhXmi28gYrWSt588PovHV87bSgbLS
-c+8k6bwEq+eyyQGozvLp06cj8W/3ez+MSpwVxQ24ZQB70Gu5oNd7LLeenF2tvmdv3sTAj/O1vIIH
-15Q9t8+bnFKTd3SlBZH2r4ER4tqElhlN+45d5qRdxRvN3II3rLTl+DlP6WYcTC1JVLb6giFMOxlp
-IpYExRAmap6mIacpYD12RYOHwDDNqPlFfgGOTxHMBN/iDhmH2mv0MKlg03KPRedEjAjwiAqoeDQ6
-RUvHoADP6eVOozk9z9O6Pb/wzN081afFa3vhjeYrkWxRMsw8OsRwzhN6rNp62MWdLOpFLMX8yk04
-dmbJr+/DHVgbJK1YLg2m8NAs0ryQ1dyYU1yxdJ7WDhjTDuFwZ7rnh6xPHAygNAL1TlZhYSXavv2T
-XRcX0w+0j3xoRtLlQ7W9O4mTQ0neqaKL43Z8SkNZQlq+NV/GMMp7SmtrT8AbS/xJJ1WxeN274sE9
-R9fk+uoGrt9o73MAOHRdkFWQlh09HeHcUWXhM9PuuXABPxSiE263aVU3STbVNwRM0WGb2o11jac9
-f3XnyULrrYCTX4AHfKhLxcFxMFU2SE+s9DRHAU7EUqcoYvdIk3/6pyzQy3vBvhL4FEiZxdQcxDVJ
-pCvLrvaE4zO+gsBR8QjqK3Nq5iE2wZzd6B17cKcxoaKncNwt5ey1wg0WU5tvPe9uZPCoITuwfC/e
-TLB7cYP47kREzyfiz51AbF7u8OohIMOTRfxkEfo+IXW9On7R2rl+4NuBsBfIy+tHTzdLZzS9cKjG
-+v6+uugRA9ANyO4ylYvDJwqxY5x/L1QNpZ3Xfk6lGeMR7ANbdaVPH7dnMujo1Qyiim2r0BzVZvxf
-O4g51qz1EJ8ARaXBFtCeWjeFL53iQ3uzGBYmavT8lUUpmQ5tjuE3vB0E3muCukK1d9NUl5FbsAM5
-AX1WkLfA2oYDQeEjeCikm0xo0b7qbAv/kYvHlen7Nhd7WH7z9V14ugI+WJY/QFCPmE6rP5Cp9rLM
-YxfmAfv19/Pfw3nvLr57NJV0r2FaYSiFhczrhN+gSWzKY5tqMCKJW0GRW96Gn/pm8OAHiyPqpvom
-vGv63P+uuesWgZ252d3tzd0/4OXSQPfdzy9DNOAwTxPiQTXjrcAO6wJXjCe6qGA4Zak/SH63E850
-j1a4D4wpYcAEKLGpxt5ozU0yd79jhcwh32Hqnucb1NWdafcOOHY5/iGKlqsB8Lk94kslHgvNgew3
-0qVUUy4anMrVSk0TvBBtSsEGFbj0vEjjvr6j+6xkonbG68RbQwCE4SZdiuhWGwNjQEDDF7NyfYhz
-PYSgoamK0inLVOmCM0jaxQVwMWeOqL/JTHJd5SiTmPBTTVVWEBWM9PWdXLgwVOvZAjWJjE2ibgzq
-psdE3+aIQ3C1jDkDyPkqjjQ86gAh+GiQczcRFypPp/Yd8Muz9qxzOrEMIfNmI6ukbu/58LdJU/Gd
-MwKd/MQFdlIVrWR2OMVFLLX84SCFyQL7/SvtZHtBxh0HnMdW6z2craiHToE95uy0Y3sMN6df7D1f
-7v0yC7oV1jXytlnLffZuE1gKc2kV6UqdO+C3+iIdvp6RM5voJjh8BHLvnrvyy3OtWmMnxaLhPHMV
-Q//mFDy6S7Z46EK0Hhf0rz7rOPp2fF9vWGbphQZ7GlsqatdqUPG0o43biBor6e6JqP1q6UdG1B78
-B0bU+vo6MDgaH60PBuun7wm9WU24d8G1jAB9pkAk3Nnr3CRmTGbkViND2Jt+Gdm7WFlnOkecjJlA
-juxfEkQg+M435ZZuencymXGHIlpfuujx9xcfXp9eEC2ml6dv/uP0e6pWwfRxx2Y9OOWQF4dM7UOv
-LtZNP+gKg6HBW2wHLlfkwx0aQu99b3N2AMLwQZ6hBe0qMvf1vg69AxH9ToD43dPuQN2nsgch9/wz
-XXzv1hV0ClgD/ZSrDc0vZ8vWPDI7FywO7c6Eed8mk7WM9nJt+xbOqfvrqxPtt+rr+PbkAce2+pRW
-AHPIyF82hWyOEthEJTsq3RvyqWQWj2GZqyxACufSuVKNblNjULV/FX8Fyi7BfTB2GCf2Wltqx+ly
-Ze9rxr2wuYwNQbxzUKP+/FxhX8hsDxWCgBWevjCMETH6T28w2e3YJ0pcHdKJy0NUNtf2F66ZdnL/
-luKma20v3lFcucHbTtB42WTuRqrt0+tAzh9l54ulU+IPmu8I6NyKpwL2Rp+JFeJsJ0IIJPWGIVYN
-Eh31rVkO8mg3HewNrZ6Jw33n8dzzaEI8399w0Tnypnu84B7qnh6qMaeeHAuM5Wv7DtqJ7wgyb+8I
-umnHcz5wT1Ff8Apfb6+eH9tkK/I7vnYUCZXZjBzDfuWUqd15u5vTnZilmlAdE8ZszjFN3eLagco+
-wb4Yp1ervycOMvu+DGnkvR8u8jE9vFurR11MLesdw5RE9ESNaVrO6QaNu30y7k+3VVt9IHxS4wFA
-eioQYCGYnm50Kud2XP4aPdNR4ayhezHdjHvoSAVV0fgcwT2M79fi1+1OJywf1J1RNP25QZcD9ZKD
-cLPvwK3GXkpkv0noTr3lgz0uAB9WHe7//AH9+/VdtvuLu/xq2+rl4AEp9mWxJBArJTokMo9jMDKg
-NyPS1lhHbgQdL6Fo6egyVDs35At0/KjMEG+9pQCDnNmp9gCsUQj+D1/Qrqc=
-""")
-
-
-
-
-
-##file ez_setup.py
-EZ_SETUP_PY = convert("""
-eJzNWmtv49a1/a5fwSgwJGE0NN8PDzRFmkyBAYrcIo8CFx5XPk+LHYpUSWoctch/v+ucQ1KkZDrt
-RT6UwcQ2ebjPfq6195G+/upwanZlMZvP538sy6ZuKnKwatEcD01Z5rWVFXVD8pw0GRbNPkrrVB6t
-Z1I0VlNax1qM16qnlXUg7DN5EovaPLQPp7X192PdYAHLj1xYzS6rZzLLhXql2UEI2QuLZ5VgTVmd
-rOes2VlZs7ZIwS3CuX5BbajWNuXBKqXZqZN/dzebWbhkVe4t8c+tvm9l+0NZNUrL7VlLvW58a7m6
-sqwS/zhCHYtY9UGwTGbM+iKqGk5Qe59fXavfsYqXz0VeEj7bZ1VVVmurrLR3SGGRvBFVQRrRLzpb
-utabMqzipVWXFj1Z9fFwyE9Z8TRTxpLDoSoPVaZeLw8qCNoPj4+XFjw+2rPZT8pN2q9Mb6wkCqs6
-4vdamcKq7KDNa6OqtTw8VYQP42irZJi1zqtP9ey7D3/65uc//7T964cffvz4P99bG2vu2BFz3Xn/
-6Ocf/qz8qh7tmuZwd3t7OB0y2ySXXVZPt21S1Lc39S3+63e7nVs3ahe79e/9nf8wm+15uOWkIRD4
-Lx2xxfmNt9icum8PJ8/2bfH0tLizFknieYzI1HG90OFJkNA0jWgsvZBFImJksX5FStBJoXFKEhI4
-vghCx5OUJqEQvnTTwI39kNEJKd5YlzAK4zhMeUIinkgWBE7skJQ7sRd7PE1fl9LrEsAAknA3SrlH
-RRS5kvgeiUToiUAm3pRF/lgXSn2XOZLFfpqSyA/jNI1DRngqQ+JEbvKqlF4XPyEJw10eCcY9zwti
-6capjDmJolQSNiElGOsSeU4QEi8QPBCuoCyOpXD8lJBARDIW4atSzn5h1CNuEkKPhBMmJfW4C30c
-n/rUZcHLUthFvlBfejQM/ZRHiGss44DwOHU9CCKpk0xYxC7zBfZwweHJKOYe96QUbuA4qR8F0iPB
-RKSZ64yVYXCHR2jIfeJ4YRSEEeLDXD9xHBI7qfO6mF6bMOZ4ETFKaeLEscfClIQ+SQLfJyHnk54x
-YsJODBdBRFgCX6YxS9IwjD0RiiREOgqasPh1MVGvTSJQSURIJ4KDPCaiwA0gzYORcPhEtAEqY994
-lAiCGnZ9jvdRRl4iYkpCGhJoxMXrYs6R4pGfypQ6EBawwAvS2PEDLpgnmMO8yUi5Y99EAUsD6VMZ
-kxhZ6AuW+MKhHsIdByn1XhfT+4ZKknqu41COMHHUBCQJzn0EPgqcJJoQc4Ez0nGigMqIEI/G3IFa
-8GyAxHYSN2beVKAucCZyIzf1hGB+KINYIGpuxHhEXA9SvXhKygXOSDcBQAF8uUSqEC9MWQop0uUx
-jRM5gVbsAmeEI3gcRInH0jShksbwdOIgex3EPHangu2Pg0SokG4kOYdhYRi6QRK4LAZ+8TRJo3BK
-ygVaUYemru8SRqjvOXAGcC6WQcBCAEXsylel9BYhSST2jHggqfRRUVSmQcQcuAqoJ6YSJhhblCi0
-BvD7HuM0ZbFHmQwAX14kvYTIKbQKxxYJkUqeOFAHBYmMlb4ApocxAIMnbjQV6XBsEZHAKi7BKm7s
-uELAuTHIKaQMhEeiKZQJL2KUcF9GAISAMUKS2A2QONyPKWPc5yGfkBKNLULBJGD5xHUjMFGSBLEH
-EWDMMEhR2lPAGV2wGwsjIsOYwr/oHlANkQNDgsBHgYVkChuisUXUkwmJQw9kD9ilPkjaQai5CCVa
-idCfkBJfwJ2DGMmUcOaTyA1F6LohyhAtRQIInMyX+IIJSCLTMAALcGC5I2kUM+lKD2HAI2+qAuKx
-RQE4lgBvJVoGFGDgB67rSi4S38W/eEqX5KIbclQv5KXwSMrBHyoFAeCJ76jGynldSm8Ro8RPgA3o
-OYLEZ47KWWQbnM3ALJM0kIwtcmPPjQFyCHTKmRs6YeqQMKG+QJ2n4VSk07FF0J0FDpoZV3mYBmkk
-AiapcBLYypypSKcXyIAkQ2MHbvWThEdAJyKEEwG8WOQHU/1dK6W3SAqE1hchcWPqegxhYmHg0hjc
-C+YXU0ySjvmIEZSNKxVqEk9wAJOb+mC2mIaphx4HUn6dDSYCjDf1rKlOd2bg2pF6l2e0m7fQu8/E
-L0xg1Pio73xQI1G7Fg+H62ZcSGv7heQZun2xxa0ldNoWmAfXlhoAVnfagExa3X01M3bjgXmoLp5h
-tmgwLigR+kV7J34xdzHfdcsgp1351aaXct+JfjjLUxfmLkyD79+r6aRuuKgw1y1HK9Q1Vya1FrTz
-4Q2mMIIxjH9lWcu/lHWd0Xww/mGkw9/7P6zmV8JuejNHj1ajv5Q+4pesWXrmfoXgVoV2l3HoxXCo
-F7Xj1eZimFv3am0pqcVmMNCtMSluMapuytpmxwq/mWTqX+AiJ6eNG87aIGFs/ObYlHv4gWG6PGEU
-Lfhtb/bgpEDN9XvyGbHE8PwFriLKQXCeMu1Amp0Z5x9bpR+telcec66mWWJ8PZTWTebFcU9FZTU7
-0lgYhHvBWpaagAvlXUti6u2VOhZcvyKsx5EjHi010i6fdxnbdbsLaK2OJow8a3G7WNlQ0njpUW2p
-5AyOMXaiGh2QPGeYuek5EwRfIyNNgmuVixL+yCtB+OmsPvb4KAfqabfr7dqzCS2mabXU0qjQqrQO
-0ScWrCx4bXzTqXEgSBTlVHhElVXWZAhd8TQ4zzARb+0vC6HPE8zZCDd6wallrnz44vmI0rI9bBCt
-MH2WU5VH7CSMKqbOiLUXdU2ehDngOBfd46POl4pktbB+PNWN2H/4RfmrMIEoLNLgnjnZIFRBizJe
-paAyxpx62F2G6p/PpN4aFIL9G2tx+Py0rURdHism6oVCGLX9vuTHXNTqlGQAoJePTU2g6jjyoHXb
-cnVGEpVym3PRDOqy9dhFCXZlt74otDMGdEViw7OiapbOWm0yALkWqPud3g1Pd2h3zLdtA7PVwLxR
-MkyAAOyXskYO0g9fQPj+pQ6Qhg5pH13vMBJtt8m1nJ81fr+Zv2ldtXrXyh6qMBbwV7Py27KQecaa
-QRxgokFOBstluVzduw9DYhgmxX9KBPOfdufCmCiF5fvNTb3qy7wrb33K+akYc8GckWLRqGrrqwdw
-ok72dPm0J3mqkI5FgSy3rb/kAsnTLb+Sp8pLVTmwScCWTkOZVXWzBmGoSllAwqnLCuvtzwPlF/aF
-vE/Fp2L57bGqIA1IbwTcVBeUtgKhndNc2KR6qu+dh9fp7MWwfpchZzN6VBT7fdn8qQRwD3KI1PWs
-LcR8/OZ6WKv3F5X+oF75Gk7RXFB+HtHpMHsNr75UxL83uapSR6aOWPW7FyhUFy05U4CVl8w0IBos
-jQ1ZY86DdUPxX0qpBpDViX9Hqb/FqOqe2vWaTg3KP54ZcoIFS8N9HfUpCmHNkeRnI1pKGdNG94FC
-BWahHjJrh3zMTdJ23enGGkDX25sanfZNrRrt+bAWLg68TeJD7pAplM+sN+OGsCZfBLTfoAE3FPD3
-MiuWHWF0S424umJKnO6Kvwd3d420Qp/uddRd3dRLI3Z1p4rhmy9lphLoIIhix06dui+2EXqrS6ci
-hyDljbrzUl4+jVap1lvFZfyuurDSfiZVsVR+fvv7XebzkBYrW3CuX8ryG50S6nOSpfgiCvUHzDlA
-2dlO5AfV5X002TboNPpUQSui8l99krNUrpgB5dcWoGqmbu1RzoWAI/EK6lD1uQBd8awglmB4rWv9
-9hDWNSjbs3ZLoHHb0Zx3hMq8y2Z7NlsCEcWd8rAWsydsp5orXgrDNTuEF0o0z2X1ud10bR0MYZS0
-Ie2ncAopNErcAEwVisADTPfoegEknyuxrZxKtAQ0NMBe/Z5RRFKsr1JmALpX7ZPOsrWqpqvX0D/o
-ZG0yNUe2bVIuxOGd+bG86LTG2dnBsKa6eq63uKAyXXItPtj4WR5Esbxa9rX1A1r82+cqawA+iDH8
-q5trYPjntfog8FlFT3UArFJlCGhkZVUddXLk4kKYjvswPVTP3Qi9vsPE7mo/VJsauWGArcaP5Wqs
-sUERbY3BivX8mc7hTjywtR1m6O5fwuinRsC7SwjABnd6F5aXtViuriCibu600OHzls060IKCufql
-g63Zv3Mp/t4j05foQb6spxj7zLkfX/uIVHPsB3RL7aqOIF5qnS8+en6tbzajQo/VVxLPa14fJ/Rc
-7lx3WeOhYTQz6Jip0hhMCqzc72GoPWoLu8Mb0o5f3dXGSLs4BxdoP6/eqLOVh5VO02exqHRaC0vR
-+G+mirJU+fmCq5Ta1xyCRccC897nZW+WyGsxiMawF7e329Zb2621wQDo2I7tLv7jrv9/AfAaXNUU
-TOsyF6jViUG46+NBJqZXv+rRK7Evv2i81ZEw33DQ8y6YowH05r+BuxfN92SX3RbVP8bNymDOGnY7
-16PfvzG+4ecrzfzkjPZya/H/ScnXyqwX/JtSrrL5pbrryu1hPKFrZzsrJD6sUuyPwDGdKerJyxmq
-dvmdHNCrrzU/+2W0pQ6gSvPl/Mertmi+7hBlDhB80kRUqcNeJCGapHNCz1cvCFwsf0A/Ne++jGMf
-TuOJcm6+ZnP9TRR7tWjHreOhZ6huiKnPAP2zfmqpIqHHLG/emnNhyHxSs+JJYfIwj6t2AlLdVneO
-3Is9u0R33ef+Wv2pVizPfbUW0rGhps1FRRfnZ/2xsnr3oT2Slh2tvngsLXu6M0OgIen7ufrjprrD
-vzXQAgNE22ualqzbyAb97uvl6qF/2a5hcU+eBzVWzOdmVjA0PXQMQoAhsulmBv39oU13134SjSlb
-dX85nKW3umfYbtu8713Sylhb2i3v2qaoc8C7S2P3pME8uIGedi1IxXbL+adi+P2fT8Xy/m+/PrxZ
-/TrXDcpqOMjotwdo9AJmg8r1N7BySygc+Gp+XaYdJhpV8f/7Oy3Y1s330l09YBDTjnyjn5qHGF7x
-6O7hZfMXz21OyLZB6lUfOGAGMzo/bjaL7VaV7Ha76D/1yJVEqKmr+L2nCbH7+959wDtv38JZplQG
-BDaonX65d/fwEjNqlDjLVIvM9X+XVxF7
-""")
-
-
-
-
-
-##file distribute_setup.py
-DISTRIBUTE_SETUP_PY = convert("""
-eJztG2tz28bxO3/FlRoNQJuEJCdpO5oyM04sp5q4tseSkw+2BjoCRxIRXsFDFPPru7t3BxyAAyXX
-bWc6U7aRSdze3t6+d+9w9Kd8X22zdDKdTn/IsqqsCp6zMIJ/o1VdCRalZcXjmFcRAE0u12yf1WzH
-04pVGatLwUpR1XmVZXEJsDhasJwHd3wjnFIOevl+zn6rywoAgrgOBau2UTlZRzGihx+AhCcCVi1E
-UGXFnu2iasuias54GjIehjQBF0TYKstZtpYrafzn55MJg8+6yBKDep/GWZTkWVEhtX5LLcF3H7mz
-wQ4L8XsNZDHOylwE0ToK2L0oSmAG0tBOneN3gAqzXRpnPJwkUVFkxZxlBXGJp4zHlShSDjzVQO2O
-57RoAFBhxsqMrfasrPM83kfpZoKb5nleZHkR4fQsR2EQP25v+zu4vfUmk2tkF/E3oIURo2BFDd9L
-3EpQRDltT0mXqMw3BQ9NeXqoFBPFvKzU38p987WKEqG/r9OEV8G2GRJJjhQ0v3lBPxsJ1VWEKiNH
-42wzmVTF/ryVYhmh9snhj1cXH/yry+uLiXgIBJB+Sc8vkMVySgPBluxtlgoDmya7XgELA1GWUlVC
-sWa+VH4/SEL3GS825UxOwQ/+BGQubNcTDyKoK76KxXzGntNQA1cAv4rUQO8FwFGXsLHlkp1ORok+
-AkUH5oNoQIohW4MUJEHshffNv5XII/Z7nVWgTPi4TkRaAevXsHwKutiCwSPElIO5AzEJku8AzDcv
-nHZJTRYiFLjNWXdM4XHgf2DcMD4cNtjmTI/LqcOOEXAAp2D6Q2rTn1oKiHXwRa1Y3vSlk5VemXOw
-Ohe+vfd/fXl5PWc9prFnpsxeXbx++fHNtf/LxYery3dvYb3pqfdn7+y7aTP08cMbfLytqvz85CTf
-55EnReVlxeZEOcHypARHFYiT8KT1SyfTydXF9cf31+/evbnyX7/8+eJVb6Hg7Gw6MYHe//yTf/n2
-9Tscn04/T/4hKh7yii9+ke7onJ15p5O34EfPDROeNKPH5eSqThIOVsEe4DP5e5aIRQ4U0u/Jyxoo
-L8zvC5HwKJZP3kSBSEsF+kpIB0J48QEQBBIc29FkMiE1Vr7GBU+wgn9n2gbEA8ScgJST3LscpsEq
-ycFFwpa1N/GSuxC/g6fGcXAb3o4XqetctEhAB45LZ64mS8AsDv1dCIhA/BtRBbtQYWi8BEGB7W5h
-jmtOJShOREgX5mW5SJtdNDC+2ofaYmeyF8RZKTC8tAa5yRSxuOkmEDQA4E/k1oGonFdb7zeAV4TN
-8WEM2mTQ+un0ZjbciMTSDrQMe5vt2C4r7kyOaWiDSiU0DENDHJfNIHvV6LYzM91JmlUdB+boiA3L
-OQq50/Mg7QJXoKMQ+gH/DlwW2xUZfA3rQuuKmZx4xsI9LEIQtEDPyxJw0aD1jK+ye6EnraMU8NhU
-QWrOTCvxqo7ggdhsXPhvrpUVvmQ+su7/Ov0/oNMkQ4qFKQMpWhD90EAYio2wrSCkvFtOjen44nf8
-u0Lfj2pDjxb4C/4UBqInqqHcgYxqWrsKUdZx1VUeWEoCKxvUHBcPsHRJw+0qBY8gRb18R6mJ6/yY
-1XFIs4hT0nY2G7QVZQUhEK1yWFelw/Mmq/VXvBR6Y8bjUMR8r1ZFVvbVQME7bZhcHJeLfH8cevB/
-5J01kYDPMWupwKCufkDEWWegQ5aHZzezp7NHmQUQ3OzFyLhH9j9Ga+8zwqVWrx5xOARIORuSD/5Q
-FJV7Omet/FX22617jCR/pas+HaB9Sr+XZBpS3r0aQ+142UuRehxYGmmSlRtyB0tU8bqwMGF59t0c
-hOOv+Z1YXhe1aLxrwsnEyxoKsx0lz6SjfFVmMRoq8mLSLmFoGoDgv67JvR0vfcklgd7Uye82PpgU
-ZW0lJbHI3yQL61iUWCl9bnbjtFzpAw49ceeHIZrOel0AqZxbXvKqKtwOIBiKHxpB15qE42zFQXsW
-TkPdCrgPopxDW7s0EGNlTTNT5t5f4y3GmddhhqfKdHfasuT75fS5Wm1mIau/iy4+lTb/mKXrOAqq
-7tICtETWDgF5E3cG/qQvOFOrhrzH6RDqICPxdgUUuu4AYnpNnp22FZo9B6M3436/PIaCBWp9FDS/
-h3SdKpnP6XSID1spAU+dCutNZeqAebfFNgH1V1RbAL4VdYrRxWPvYwHiseLTrQPOkqxAUgNM0TSh
-66goqzmYJqCxTncA8V67HLb4aOzL8Szwn9PPqftjXRSwSryXiNlxMQPkHf8vPKziMHMYqrIUWlS5
-L7pjIi4t9gEayHomZ9j3p56fuMEpGJmpsZPdjRWzX2INT4ohYxZj1esmm4FV32bV66xOw6822kfJ
-tJE4SHUOuSs/KASvRN9b+bg5ssAmi8JwdSBKf23Moo8lcKl4pbww1MOv2hZfY64UV5tGIthenAVU
-ulCbUzE+qmTnLoVKXiaFt4r2W1ZuKTNbYTvynsdRB7u2vLROVqIAi+Zkyo1XIFzY/qOklzomTR8S
-tICmCHbb4cctwx6HCz4i2OrVRRrKsIk9Ws6cE2fmsVvJk1tcsZP7g38RhdApZNPv0quI0JN7JA42
-09UeqMMaZGlIvc6cY6BfiTW6G2xrBlXN47bjSvursJKqPC2G/0jC0IlFJNS6gCp4RVFIYJtb9ZuL
-GMuqiWGN1lhpoHhhm1tt/vBRHbD100mOPSzDNn+gA1TSl03topOroiDZ8waLzP/4vQCWjqTgGlRl
-l0WA6GBfqrVqWGsvb5ZoZ+fI85f3WYRanaPlhg05bYYzCOlN8dJYD/n4cjrHLXVdtiRKcckdDB+x
-D4KHJxRbGQYYSM6AdLYCk7ubY4d9h0qI0VC6FtDkICsKcBdkfT1ksFvSam0vEZ51VILgtQrrDzbl
-MEEoAtAHHvYyKslGIloya86mu9V0AKTSAkTWjg18ppIErGVJMYAAXaL34AG/JdzBoiZ82zklCcNe
-YrIEJWNVCYK7LsF7rbIHd12nAXoz5QRp2Byn9uqcPXt2t5sdyIpl87+tT9R0bRivtGe5ks8PJcx9
-WMyZoZC2JctI7X2UyVbSoM1ufnJeloOB/koergOCHj5vFnkCjgYWMI3Py/HYhUoXLJKekNi0E15z
-AHhyPt+fNy5DpTtaIzqif1Sb1TJDug8zyCoCa1JnhzSV3tRbpehElY++wUUzmIO7AA+QVm3I/5Vi
-Gw/u6py8xVom1iKVO4LIrgMSeUvwbb7CoT0CIp6ZXgO4MYRd6qVbDh2Bj8Npe808S0/rZRfCbJeq
-Xbfa0M56j9BYCnh6AmSTGBt8cgZEscznzE2Aoe0cW7BUbk3zzp4Jrm1+iHR7YogB1jO9izGifRMe
-Kmu2WYWmXVyf9waPFarBniWCVOx0ZManEGUd792bV95xiUdaeDrq4Z9BZ/cDopPBDQNJJnuKkkSN
-UzV5sbbFn65tVG1AP2yITbJ7SJbBNHyzQ+7mMQ/EFpRd6E51L4xHJfYah2Bd6j+mdxAIO813SLzU
-Hoy54/q1xrqj438wHdUXAoxGsJ0UoFqdNnvqXxfnzs1+zDPsGC6wOOi7e734wFuuQPp3JlvW3fKo
-5UDbIaUU3jw0N9ftMWAy0AKQE2qBiIU8ks3qCpNe9B47vm9tTtc5/YTNYM+cSdVX5PckquYbnGid
-ubIcINvvwEpX1Ykgg0nSH6oZc2Y5r1SdbcXRgW9vuQGmwPsuas661FiV6Qgw71gsKqdkqPiN8+3z
-s1E0xW/UNdds4c17zT/VwsebCPjV4J7GcEgeCqZzHNbvMyuQXrVrepsBlmFMt+klOFXZuAe2amIV
-J0ba6M5Ve5EnNNoETm8nXX885mv63nkMTvtqvoZ0ujkixvUVU4wAhiDNjZWmbd3YSMt7LFcAA56K
-gf9PEiDCz1a/ue2Bo6d73TmUhFB3ycj2WJeh49wk3V8ypeNyTXJBJS3F1GNu2CJszRzdWBi6IOLU
-/p54BCanIpX75FMTWRG2G1WR2LAidWhTtn4QFvjc0Tl37KrAXNL2BU6vR8rA/2leDh2g1fNI8AN+
-p+/Df0T5y0g+mNWmRI2DPJwWWd0nAYynSJJVVZMTjbPKkJEHE5x+UtLbSrU1ONpuRT1+bCsdMoxO
-WV9ej+/vMRPre5pHwGedfL4Jem1Od6RCCUSg4A5VKcJftvx6VEFlBnzx008LFCGGEBCn/P4FChoN
-UtiDcXYsJjw1rhq+vY2tI8k+EJ/cNXzrPjrIitkjpv0o5/4rNmWwolN2KG2xVx5qUOuX7FM2EW0Q
-zX6QfczRcGY5mVOYqVnr54VYRw+u9vRtcGmCHIUGdSgJ9fe9cd5v7A1/qwt1GvCT/gJRMhQPRth8
-fnZ+02RRNDjX1+5EWiei4PJCntk7QVB5Y1XmW4tFAXuV9yDkJvoJOmwCcHiwZlGV2GZGJV5iGJF4
-LI2ZKsuVZGhmHkeV6+A6S2f2adE7nTNYoNlnLqZw9Y+IJFVYGkoqrAeuMWimvEX4veSPvYfUIbf8
-RJDPLVR+KaUtjcDcuhSFQ0cL7eVYdVSIbVxrx8a2SjPbYhhSIweq2lf2q4DTgaJx7qivR9psd/Rg
-/FCH6ojthAMWFQAJliBvZLegkMatnjATkimlEAmeM5jHo8MuCf3cobl0SwV17wjZMNyQEYcwMYXJ
-u9LDrK17pu99kOe9mGyDVyzAGXXKE3vi3tMWivmIYUluXHlcxbnrfS4GfMNWpXGQ9PL95b+Z8Flb
-BPYRgkJ2ldG8zWW+W2CWJLIwt4vmiIWiEurWHAZvPIlvIiBqatjPYZtjuGWfPE8P9fXZfOfBKHrk
-0qDduh1iWUXxgg4VpC9EhSRfGD0QsXmR3UehCOXrD9FawZsvWpRG8yFUF+6SeXuooTuOZsXRDRw2
-yuxSUNiAofM+wYBInoXY7oEOtVXeCAdatlB/jNconTQMrFLKsTSv66ktWTbhiTRUQYPujI1sKl3I
-23yt8Dp0oH2P99GsUtWTFWmAw+ZhLU0V48LnOEljGZOFlMMJlCLRHcs/Uee63YgvyEFHk9ADzece
-b7rzhu1nUzeaozs0azpflu6PznoNf5+Kvmi72f/XyrNHL512psJomMe8ToNtm8K1T/qR8oMa6ewZ
-Qxvbcmxt4RtJEoIKfv1Gi4TKo5wlvLjDs/yMcTqA5e2EVd0YT5PqnX9zg+nCJ2cRmDeyKTvDKzax
-WKgWwEI80PtLkDMvEp5C7A6dGyPEaYynN00/AJtmZoL5qfvGxQ173kybaBx0P8f6Mk3DPeNScini
-tWycL6fedM4SgRcHyiXGlPZkRl2kpoNgBSGPGekSQAHclqzFn4G8YqTvEev9tRca0Cfju17ZLsWq
-OslCfCtM+n9s9hNALookKkt6Tas9stNIIlBCaniBzMPSY7e4Aae5GIKvaAHStSBCBteogVDFAfgK
-k9WOHPTEMjXlMRGR4Ct3dFkE+EkkUwNQ48Eeu9Ji0NjVnm1EpXC5s+4NCpWQBVm+N39DIQYZv7oR
-KBkqr5NrAMX49tqgyQHQh5smL9BiGeQDegBjc7yeNNUHrET+ECKKAulUzmpY9b97fulIE9ahR11o
-KflaoFRF71i/hfR4DhVo6Ko1uq5M07Ukbnn45yAg3ifDvs233/6VcpcgSkB8VDQBfad/OT01krF4
-7SnRa5xS+Zuc4oNAaxWsRO6bJJuGb/b02N+Y+2LOvjU4hDaG80XhAoazOeJ5MbOWC0GSE4yHTQIJ
-6LWnU322IVJXYrYDFJJ613b0MEB0J/ZLrYAeHveD+iLNDhLgzOZMYZNXhzWDIHOjix6Aq7HgxmpR
-dUkcmMr1mddTOmO8QySdA1rbGlrgXQYNzs5JysEWiGtlrPDOhoA1nS8+ATDYws4OAKoCwbTYf+HW
-q1RRnBwD92Oogs+GFTDdKO5V17Z7CoTMD1cbF5RwqlwLvsmGF56EDgcJj6jmvp+zkUt+bSC4PPS6
-K6nABS/3Cko7v8PX/1WM77/cBsRFdP8FkyefKnLfR1J9X71LSXQ3UfPs/GY2+ScwBeVg
-""")
-
-
-
-
-
-##file activate.sh
-ACTIVATE_SH = convert("""
-eJytVU1v4jAQPW9+xTT0ANVS1GsrDlRFAqmFqmG72m0rY5IJsRRslDiktNr/vuMQ8tFQpNU2B4I9
-H36eeW/SglkgYvBFiLBKYg0LhCRGD1KhA7BjlUQuwkLIHne12HCNNpz5kVrBgsfBmdWCrUrA5VIq
-DVEiQWjwRISuDreW5eE+CtodeLeAnhZEGKMGFXqAciMiJVcoNWx4JPgixDjzEj48QVeCfcqmtzfs
-cfww+zG4ZfeD2ciGF7gCHaDMPM1jtvuHXAsPfF2rSGeOxV4iDY5GUGb3xVEYv2aj6WQ0vRseAlMY
-G5DKsAawwnQUXt2LQOYlzZoYByqhonqoqfxZf4BLD97i4DukgXADCPgGgdOLTK5arYxZB1xnrc9T
-EQFcHoZEAa1gSQioo/TPV5FZrDlxJA+NzwF+Ek1UonOzFnKZp6k5mgLBqSkuuAGXS4whJb5xz/xs
-wXCHjiVerAk5eh9Kfz1wqOldtVv9dkbscfjgjKeTA8XPrtaNauX5rInOxaHuOReNtpFjo1/OxdFG
-5eY9hJ3L3jqcPJbATggXAemDLZX0MNZRYjSDH7C1wMHQh73DyYfTu8a0F9v+6D8W6XNnF1GEIXW/
-JrSKPOtnW1YFat9mrLJkzLbyIlTvYzV0RGXcaTBfVLx7jF2PJ2wyuBsydpm7VSVa4C4Zb6pFO2TR
-huypCEPwuQjNftUrNl6GsYZzuFrrLdC9iJjQ3omAPBbcI2lsU77tUD43kw1NPZhTrnZWzuQKLomx
-Rd4OXM1ByExVVkmoTwfBJ7Lt10Iq1Kgo23Bmd8Ib1KrGbsbO4Pp2yO4fpnf3s6MnZiwuiJuls1/L
-Pu4yUCvhpA+vZaJvWWDTr0yFYYyVnHMqCEq+QniuYX225xmnzRENjbXACF3wkCYNVZ1mBwxoR9Iw
-WAo3/36oSOTfgjwEEQKt15e9Xpqm52+oaXxszmnE9GLl65RH2OMmS6+u5acKxDmlPgj2eT5/gQOX
-LLK0j1y0Uwbmn438VZkVpqlfNKa/YET/53j+99G8H8tUhr9ZSXs2
-""")
-
-
-
-
-
-##file activate.fish
-ACTIVATE_FISH = convert("""
-eJydVm1v4jgQ/s6vmA1wBxUE7X2stJVYlVWR2lK13d6d9laRk0yIr8HmbIe0++tvnIQQB9pbXT5A
-Ys/LM55nZtyHx5RrSHiGsMm1gRAh1xhDwU0Kng8hFzMWGb5jBv2E69SDs0TJDdj3MxilxmzPZzP7
-pVPMMl+q9bjXh1eZQ8SEkAZULoAbiLnCyGSvvV6SC7IoBcS4Nw0wjcFbvJDcjiuTswzFDpiIQaHJ
-lQAjQUi1YRmUboC2uZJig8J4PaCnT5IaDcgsbm/CjinOwgx1KcUTMEhhTgV4g2B1fRk8Le8fv86v
-g7v545UHpZB9rKnp+gXsMhxLunIIpwVQxP/l9c/Hq9Xt1epm4R27bva6AJqN92G4YhbMG2i+LB+u
-grv71c3dY7B6WtzfLy9bePbp0taDTXSwJQJszUnnp0y57mvpPcrF7ZODyhswtd59+/jdgw+fwBNS
-xLSscksUPIDqwwNmCez3PpxGeyBYg6HE0YdcWBxcKczYzuVJi5Wu915vn5oWePCCoPUZBN5B7IgV
-MCi54ZDLG7TUZ0HweXkb3M5vFmSpFm/gthhBx0UrveoPpv9AJ9unIbQYdUoe21bKg2q48sPFGVwu
-H+afrxd1qvclaNlRFyh1EQ2sSccEuNAGWQwysfVpz1tPajUqbqJUnEcIJkWo6OXDaodK8ZiLdbmM
-L1wb+9H0D+pcyPSrX5u5kgWSygRYXCnJUi/KKcuU4cqsAyTKZBiissLc7NFwizvjxtieKBVCIdWz
-fzilzPaYyljZN0cGN1v7NnaIPNCGmVy3GKuJaQ6iVjE1Qfm+36hglErwmnAD8hu0dDy4uICBA8ZV
-pQr/q/+O0KFW2kjelu9Dgb9SDBsWV4F4x5CswgS0zBVlk5tDMP5bVtUGpslbm81Lu2sdKq7uNMGh
-MVQ4fy9xhogC1lS5guhISa0DlBWv0O8odT6/LP+4WZzDV6FzIkEqC0uolGZSZoMnlpxplmD2euaT
-O4hkTpPnbztDccey0bhjDaBIqaWQa0uwEtQEwtyU56i4fq54F9IE3ORR6mKriODM4XOYZwaVYLYz
-7SPbKkz4i7VkB6/Ot1upDE3znNqYKpM8raa0Bx8vfvntJ32UENsM4aI6gJL+jJwhxhh3jVIDOcpi
-m0r2hmEtS8XXXNBk71QCDXTBNhhPiHX2LtHkrVIlhoEshH/EZgdq53Eirqs5iFKMnkOmqZTtr3Xq
-djvPTWZT4S3NT5aVLgurMPUWI07BRVYqkQrmtCKohNY8qu9EdACoT6ki0a66XxVF4f9AQ3W38yO5
-mWmZmIIpnDFrbXakvKWeZhLwhvrbUH8fahhqD0YUcBDJjEBMQwiznE4y5QbHrbhHBOnUAYzb2tVN
-jJa65e+eE2Ya30E2GurxUP8ssA6e/wOnvo3V78d3vTcvMB3n7l3iX1JXWqk=
-""")
-
-
-
-
-
-##file activate.csh
-ACTIVATE_CSH = convert("""
-eJx9U11vmzAUffevOCVRu+UB9pws29Kl0iq1aVWllaZlcgxciiViItsQdb9+xiQp+dh4QOB7Pu49
-XHqY59IgkwVhVRmLmFAZSrGRNkdgykonhFiqSCRW1sJSmJg8wCDT5QrucRCyHn6WFRKhVGmhKwVp
-kUpNiS3emup3TY6XIn7DVNQyJUwlrgthJD6n/iCNv72uhCzCpFx9CRkThRQGKe08cWXJ9db/yh/u
-pvzl9mn+PLnjj5P5D1yM8QmXlzBkSdXwZ0H/BBc0mEo5FE5qI2jKhclHOOvy9HD/OO/6YO1mX9vx
-sY0H/tPIV0dtqel0V7iZvWyNg8XFcBA0ToEqVeqOdNUEQFvN41SumAv32VtJrakQNSmLWmgp4oJM
-yDoBHgoydtoEAs47r5wHHnUal5vbJ8oOI+9wI86vb2d8Nrm/4Xy4RZ8R85E4uTZPB5EZPnTaaAGu
-E59J8BE2J8XgrkbLeXMlVoQxznEYFYY8uFFdxsKQRx90Giwx9vSueHP1YNaUSFG4vTaErNSYuBOF
-lXiVyXa9Sy3JdClEyK1dD6Nos9mEf8iKlOpmqSNTZnYjNEWiUYn2pKNB3ttcLJ3HmYYXy6Un76f7
-r8rRsC1TpTJj7f19m5sUf/V3Ir+x/yjtLu8KjLX/CmN/AcVGUUo=
-""")
-
-
-
-
-
-##file activate.bat
-ACTIVATE_BAT = convert("""
-eJyFUkEKgzAQvAfyhz0YaL9QEWpRqlSjWGspFPZQTevFHOr/adQaU1GaUzI7Mzu7ZF89XhKkEJS8
-qxaKMMsvboQ+LxxE44VICSW1gEa2UFaibqoS0iyJ0xw2lIA6nX5AHCu1jpRsv5KRjknkac9VLVug
-sX9mtzxIeJDE/mg4OGp47qoLo3NHX2jsMB3AiDht5hryAUOEifoTdCXbSh7V0My2NMq/Xbh5MEjU
-ZT63gpgNT9lKOJ/CtHsvT99re3pX303kydn4HeyOeAg5cjf2EW1D6HOPkg9NGKhu
-""")
-
-
-
-
-
-##file deactivate.bat
-DEACTIVATE_BAT = convert("""
-eJxzSE3OyFfIT0vj4spMU0hJTcvMS01RiPf3cYkP8wwKCXX0iQ8I8vcNCFHQ4FIAguLUEgWIgK0q
-FlWqXJpcICVYpGzx2BAZ4uHv5+Hv6wq1BWINXBTdKriEKkI1DhW2QAfhttcxxANiFZCBbglQSJUL
-i2dASrm4rFz9XLgAwJNbyQ==
-""")
-
-
-
-
-
-##file distutils-init.py
-DISTUTILS_INIT = convert("""
-eJytV92L4zYQf/dfMU0ottuse7RvC6FQrg8Lxz2Ugz4si9HacqKuIxlJ2ST313dG8odkO9d7aGBB
-luZLv/nNjFacOqUtKJMIvzK3cXlhWgp5MDBsqK5SNYftsBAGpLLA4F1oe2Ytl+9wUvW55TswCi4c
-KibhbFDSglXQCFmDPXIwtm7FawLRbwtPzg2T9gf4gupKv4GS0N262w7V0NvpbCy8cvTo3eAus6C5
-ETU3ICQZX1hFTw/dzR6V/AW1RCN4/XAtbsVXqIXmlVX6liS4lOzEYY9QFB2zx6LfoSNjz1a0pqT9
-QOIfJWQ2E888NEVZNqLlZZnvIB0NpHkimlFdKn2iRRY7yGG/CCJb6Iz280d34SFXBS2yEYPNF0Q7
-yM7oCjpWvbEDQmnhRwOs6zjThpKE8HogwRAgraqYFZgGZvzmzVh+mgz9vskT3hruwyjdFcqyENJw
-bbMPO5jdzonxK68QKT7B57CMRRG5shRSWDTX3dI8LzRndZbnSWL1zfvriUmK4TcGWSnZiEPCrxXv
-bM+sP7VW2is2WgWXCO3sAu3Rzysz3FiNCA8WPyM4gb1JAAmCiyTZbhFjWx3h9SzauuRXC9MFoVbc
-yNTCm1QXOOIfIn/g1kGMhDUBN72hI5XCBQtIXQw8UEEdma6Jaz4vJIJ51Orc15hzzmu6TdFp3ogr
-Aof0c98tsw1SiaiWotHffk3XYCkqdToxWRfTFXqgpg2khcLluOHMVC0zZhLKIomesfSreUNNgbXi
-Ky9VRzwzkBneNoGQyyvGjbsFQqOZvpWIjqH281lJ/jireFgR3cPzSyTGWzQpDNIU+03Fs4XKLkhp
-/n0uFnuF6VphB44b3uWRneSbBoMSioqE8oeF0JY+qTvYfEK+bPLYdoR4McfYQ7wMZj39q0kfP8q+
-FfsymO0GzNlPh644Jje06ulqHpOEQqdJUfoidI2O4CWx4qOglLye6RrFQirpCRXvhoRqXH3sYdVJ
-AItvc+VUsLO2v2hVAWrNIfVGtkG351cUMNncbh/WdowtSPtCdkzYFv6mwYc9o2Jt68ud6wectBr8
-hYAulPSlgzH44YbV3ikjrulEaNJxt+/H3wZ7bXSXje/YY4tfVVrVmUstaDwwOBLMg6iduDB0lMVC
-UyzYx7Ab4kjCqdViEJmDcdk/SKbgsjYXgfMznUWcrtS4z4fmJ/XOM1LPk/iIpqass5XwNbdnLb1Y
-8h3ERXSWZI6rZJxKs1LBqVH65w0Oy4ra0CBYxEeuOMbDmV5GI6E0Ha/wgVTtkX0+OXvqsD02CKLf
-XHbeft85D7tTCMYy2Njp4DJP7gWJr6paVWXZ1+/6YXLv/iE0M90FktiI7yFJD9e7SOLhEkkaMTUO
-azq9i2woBNR0/0eoF1HFMf0H8ChxH/jgcB34GZIz3Qn4/vid+VEamQrOVqAPTrOfmD4MPdVh09tb
-8dLLjvh/61lEP4yW5vJaH4vHcevG8agXvzPGoOhhXNncpTr99PTHx6e/UvffFLaxUSjuSeP286Dw
-gtEMcW1xKr/he4/6IQ6FUXP+0gkioHY5iwC9Eyx3HKO7af0zPPe+XyLn7fAY78k4aiR387bCr5XT
-5C4rFgwLGfMvJuAMew==
-""")
-
-
-
-
-
-##file distutils.cfg
-DISTUTILS_CFG = convert("""
-eJxNj00KwkAMhfc9xYNuxe4Ft57AjYiUtDO1wXSmNJnK3N5pdSEEAu8nH6lxHVlRhtDHMPATA4uH
-xJ4EFmGbvfJiicSHFRzUSISMY6hq3GLCRLnIvSTnEefN0FIjw5tF0Hkk9Q5dRunBsVoyFi24aaLg
-9FDOlL0FPGluf4QjcInLlxd6f6rqkgPu/5nHLg0cXCscXoozRrP51DRT3j9QNl99AP53T2Q=
-""")
-
-
-
-
-
-##file activate_this.py
-ACTIVATE_THIS = convert("""
-eJyNUlGL2zAMfvevEBlHEujSsXsL9GGDvW1jD3sZpQQ3Ua7aJXawnbT595Ocpe0dO5ghseVP+vRJ
-VpIkn2cYPZknwAvWLXWYhRP5Sk4baKgOWRWNqtpdgTyH2Y5wpq5Tug406YAgKEzkwqg7NBPwR86a
-Hk0olPopaK0NHJHzYQPnE5rI0o8+yBUwiBfyQcT8mMPJGiAT0A0O+b8BY4MKJ7zPcSSzHaKrSpJE
-qeDmUgGvVbPCS41DgO+6xy/OWbfAThMn/OQ9ukDWRCSLiKzk1yrLjWapq6NnvHUoHXQ4bYPdrsVX
-4lQMc/q6ZW975nmSK+oH6wL42a9H65U6aha342Mh0UVDzrD87C1bH73s16R5zsStkBZDp0NrXQ+7
-HaRnMo8f06UBnljKoOtn/YT+LtdvSyaT/BtIv9KR60nF9f3qmuYKO4//T9ItJMsjPfgUHqKwCZ3n
-xu/Lx8M/UvCLTxW7VULHxB1PRRbrYfvWNY5S8it008jOjcleaMqVBDnUXcWULV2YK9JEQ92OfC96
-1Tv4ZicZZZ7GpuEpZbbeQ7DxquVx5hdqoyFSSmXwfC90f1Dc7hjFs/tK99I0fpkI8zSLy4tSy+sI
-3vMWehjQNJmE5VePlZbL61nzX3S93ZcfDqznnkb9AZ3GWJU=
-""")
-
-
-
-
-
-if __name__ == '__main__':
- main()
-
-## TODO:
-## Copy python.exe.manifest
-## Monkeypatch distutils.sysconfig
deleted file mode 100644
index f01250a99ac147ef2ca3c5a52672d685ba6d4212..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index 1934ac3590fa279d1a6ee9ad641e520ddb938d6a..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index b2c15924105357853f56f6ad34589f36dd600e0f..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index b004539db3499bb7a645cfb6a7e83286932f8195..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index 3c72d15b5b10eba024ecbb3395507a5ede16de72..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index 8a51424a41f5fcf57b66f73c7ae9af5e931d2257..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
--- a/mail/testsuite-targets.mk
+++ b/mail/testsuite-targets.mk
@@ -1,45 +1,36 @@
# Additional mailnews targets to call automated test suites
include $(topsrcdir)/mailnews/testsuite-targets.mk
# Instructions below this line are for mail/ specific tests.
MOZMILLDIR=$(DEPTH)/mozilla/_tests/mozmill
-ifeq ($(OS_ARCH),WINNT)
-VIRTUALENV_BIN = $(MOZMILLDIR)/../mozmill-virtualenv/Scripts
-else
-VIRTUALENV_BIN = $(MOZMILLDIR)/../mozmill-virtualenv/bin
-endif
-MOZMILLPYTHON = $(call core_abspath,$(VIRTUALENV_BIN)/python$(BIN_SUFFIX))
ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
# Mac options
APP_NAME = $(MOZ_APP_DISPLAYNAME)
ifdef MOZ_DEBUG
APP_NAME := $(APP_NAME)Debug
endif
PROGRAM = ../../../$(DIST)/$(APP_NAME).app/
else
# Non-mac options
PROGRAM = ../../../$(DIST)/bin/thunderbird$(BIN_SUFFIX)
endif
-# PYTHONHOME messes very badly with virtualenv setups, so unset it.
mozmill::
- unset PYTHONHOME && cd $(MOZMILLDIR) && MACOSX_DEPLOYMENT_TARGET= \
- $(MOZMILLPYTHON) runtestlist.py --list=mozmilltests.list \
- --binary=$(PROGRAM) \
+ cd $(MOZMILLDIR) && MACOSX_DEPLOYMENT_TARGET= $(PYTHON) \
+ runtestlist.py --list=mozmilltests.list --binary=$(PROGRAM) \
--dir=$(call core_abspath,$(topsrcdir))/mail/test/mozmill \
--symbols-path=$(call core_abspath,$(DIST)/crashreporter-symbols) \
$(MOZMILL_EXTRA)
mozmill-one::
- unset PYTHONHOME && cd $(MOZMILLDIR) && MACOSX_DEPLOYMENT_TARGET= \
- $(MOZMILLPYTHON) runtest.py \
+ cd $(MOZMILLDIR) && MACOSX_DEPLOYMENT_TARGET= $(PYTHON) runtest.py \
--test=$(call core_abspath,$(topsrcdir))/mail/test/mozmill/$(SOLO_TEST) \
--binary=$(PROGRAM) \
--symbols-path=$(call core_abspath,$(DIST)/crashreporter-symbols) \
$(MOZMILL_EXTRA)
# XXX The mozilla/testing/testsuite-targets.mk doesn't really allow for hooks
# outside of itself. Therefore we replicate the functionality we need here,
# calling into the relevant mozilla dirs when necessary for the core tests.
--- a/mailnews/test/resources/logHelper.js
+++ b/mailnews/test/resources/logHelper.js
@@ -438,27 +438,16 @@ function _normalize_for_json(aObj, aDept
message: aObj.message,
fileName: aObj.fileName,
lineNumber: aObj.lineNumber,
name: aObj.name,
stack: aObj.stack ? aObj.stack.split(/\n\r?/g) : null,
_stringRep: aObj.message,
};
}
- else if (aObj instanceof Ci.nsIException) {
- return {
- type: "error",
- message: "nsIException: " + aObj.name,
- fileName: aObj.filename,
- lineNumber: aObj.lineNumber,
- name: aObj.name,
- result: aObj.result,
- stack: null,
- };
- }
else if (aObj instanceof Ci.nsIStackFrame) {
return {
type: "stackFrame",
name: aObj.name,
fileName: aObj.filename, // intentionally lower-case
lineNumber: aObj.lineNumber,
};
}